Reputation: 209
I have a JSON
$data= '[
{
"opa": "maam",
"clik": "7026981995",
"pt": 123,
"aaab": [{
"ttt": "1.22",
"tt": [{
"aaa2": 1.2277,
"aaa122": 19811225
}]
}]
},
{
"opaa": "maam1",
"clik1": "7026981995",
"pt1": 123,
"aaa11": [{
"ttt1": "1.222",
"tt1": [{
"aaa1": 1.2277,
"aaa3": 19811225
}]
}]
}
]'
I need to print it on the screen, just as it is in the variable, I tried
echo json_encode($data, JSON_PRETTY_PRINT);
But, a pile is printed, not being readable.
Upvotes: 0
Views: 46
Reputation: 76639
how about <pre>
, which is the "preformatted text element"?
die('<pre>'.print_r(json_decode($data), true).'</pre>');
this would also work (which I'd assume is what you've meant):
die('<pre>'.$data.'</pre>');
Upvotes: 1
Reputation: 121
change the code to:
print_r(json_decode($data), true)
Get JSON formater extension for chrome to prettify the json.
Upvotes: 0