Print Json PHP Variable

Asked

Viewed 37 times

-2

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, the same way it’s on the variable, I tried

echo json_encode($data, JSON_PRETTY_PRINT);

But, is printed a heap, not becoming legible.

1 answer

0

Solved

echo '<pre>'.print_r(json_decode($data), true).'</pre>';

Browser other questions tagged

You are not signed in. Login or sign up in order to post.