wp_json_encode() prints the JSON string in one line. Can we make it pretty?
CodePudding user response:
You can make use of wp_json_encode() options parameter.
Setting options to JSON_PRETTY_PRINT
as an argument will make the function use whitespace in returned data to format it:
wp_json_encode($data, JSON_PRETTY_PRINT);