php - Display json array -


i trying read api have implemented wordpress using wp-api v2, have used several plugins return information need.

the source json can found here.

i need return pure_taxonomies->property-status->name.

i have tried following blank page:

foreach($select_api $p) {   echo '   status:'.$p->pure_taxonomies->property-status->name.'   '; } 

any great!

first of all, if have json_encoded string, should decode json_decode() decoded json , array 2 elements. error because of hyphen property-status in name of property. should use curly braces:

status:'.$p->pure_taxonomies->{"property-status"}[0]->name.' 

important.

  1. use curly braces property names hyphen

  2. don't forget in structure property-status array. that's why used index 0 first element


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -