$sanitizerjson()

Sanitize value to formatted and readable JSON string

If you do not need formatted/readable JSON string then use PHP’s json_encode() function instead.

Available since version 3.0.256.

Usage

// basic usage
$false = $sanitizer->json(mixed $value);

// usage with all arguments
$false = $sanitizer->json(mixed $value, array $options = []);

Arguments

NameType(s)Description
$valuemixed
$options (optional)array
  • pretty (bool): Make it readable/pretty Default:true
  • escaped (bool): Escape unicode, slashes and line terminators? Default:true

Return value

false string


$sanitizer methods and properties

API reference based on ProcessWire core version 3.0.257