You can't use a JSON literal in PHP like that. Turn it into a string (wrap it in quotes), and then use json_decode()
to access it in an object like manner.
If you'd prefer to access it like an array, set json_decode()
's second argument to TRUE
.
Update
I see you have wrapped it in quotes - you must now escape the inner quotes.
To loop through it, just use foreach()
on the object or array returned from json_decode()
.
To visualise the structure once parsed via json_decode()
, use var_dump()
.
Update
Your problem is, your JSON is not proper - it has 2 objects, but not in array literal syntax. You need to wrap that structure with []
.
See it.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…