3 // Pretty print some JSON
4 function json_format($json)
12 commented out by monk.e.boy 22nd May '08
13 because my web server is PHP4, and
14 json_* are PHP5 functions...
16 $json_obj = json_decode($json);
18 if($json_obj === false)
21 $json = json_encode($json_obj);
25 for($c = 0; $c < $len; $c++
)
34 $new_json .= $char . "\n" . str_repeat($tab, $indent_level+
1);
47 $new_json .= "\n" . str_repeat($tab, $indent_level) . $char;
57 $new_json .= ",\n" . str_repeat($tab, $indent_level);
75 if($c > 0 && $json[$c-1] != '\\')
77 $in_string = !$in_string;