using json in plugin
-
Hello wp specialists,
I have this json string in a variable $page_content :
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"postcode":["38660"],"citycode":["38395","38"],"city":["plateau-des-petites-roches"],"toponym":"Plateau-des-Petites-Roches","extrafields":{"population":2380,"status":"","cleabs":"COMMUNE_0000002200276548","names":["plateau-des-petites-roches"]},"category":["administratif","commune"],"_score":1,"distance":0,"_type":"poi"},"geometry":{"type":"Point","coordinates":[5.893712562,45.333663943]}}]}
I need the code to retrieve the data associated with “city”.
I’ve tried this:$obj = json_decode($page_content); echo $obj->type;
it returns FeaturesCollections but I need what’s linked to “city”…
Help!
Thanks
Jacques from Grenoble France
- The topic ‘using json in plugin’ is closed to new replies.