|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-09-16 15:54 UTC] aharvey@php.net
-Status: Open
+Status: Duplicate
[2010-09-16 15:54 UTC] aharvey@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 06:00:01 2025 UTC |
Description: ------------ When trying to debug a large amount of JSON output that has been created using json_encode, it would be really nice to have an option to format the output beautifully, with some line-breaks and indenting, so the the generated JSON is easier to read. Something a bit like the output of print_r. Test script: --------------- $bigarray = array(); for ($i = 0; $i < 100; $i++) { $bigarray['key' . $i] = 'value' . $i; } echo json_encode($bigarray, JSON_PRETTY_PRINT); // Will error, because I made up the JSON_PRETTY_PRINT constant name. Expected result: ---------------- { "key0":"value0", "key1":"value1", "key2":"value2", ... } Actual result: -------------- {"key0":"value0","key1":"value1","key2":"value2",...