json_decoded Pass a json string to |json_decoded and it will return an object.
{{ entry.jsonField|json_decoded }}
To return an array instead of an object, pass a parameter of 'true'.
{{ entry.jsonField|json_decoded('true') }}
|json_decoded accepts all of the parameters that the json_decoded function in PHP accepts.
{{ entry.jsonField|json_decoded('object/associative', 'depth', 'option') }}
Object/associative is set to false by default returning an object. Depth (passed as an integer), sets the depth to which the json is decoded. Default recursion depth in PHP is 512. Options available are: JSON_BIGINT_AS_STRING - Decodes large integers as their original string value. JSON_OBJECT_AS_ARRAY - Decodes as array. Default of |json_decoded. JSON_THROW_ON_ERROR - Throws JsonException if an error occurs instead of setting the global error state that is retrieved with json_last_error().
json_last_error_msg Returns the error string of json_decoded.
{{ entry.jsonField|json_last_error_msg }}
Accepts 'encode' as a parameter to return the error string of json_encode.
{{ entry.jsonField|json_last_error_msg('encode') }}
json_last_error Returns the last error of json_decoded.
{{ entry.jsonField|json_last_error }}
Accepts 'encode' as a parameter to return the last error of json_encode.
{{ entry.jsonField|json_last_error('encode') }}
To install this plugin, copy the command above to your terminal.
This plugin doesn't have any reviews.