Aaron Aaron - 1 year ago 110
JSON Question

Display json array

I am trying to read an api i have implemented with Wordpress using WP-API V2, i have used several plugins to return the information i need...

The json can be found here:

I need to return pure_taxonomies->property-status->name

I have tried the following but i just get a blank page:

foreach($select_api as $p)
echo '

Any help would be great!

Answer Source

First of all, if you have json_encoded string, you should decode it with json_decode() I decoded your json and get array with two elements. Your error is probably because of hyphen property-status in name of property. You should use curly braces:



  1. Use curly braces for property names with hyphen

  2. Don't forget that in your structure property-status is array. That's why I used index 0 to get first element

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download