0

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 source 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 '
  Status:'.$p->pure_taxonomies->property-status->name.'
  ';
}

Any help would be great!

Hafenkranich
  • 1,696
  • 18
  • 32
Aaron
  • 3
  • 3

1 Answers1

0

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:

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

IMPORTANT.

  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

Dmytrechko
  • 598
  • 3
  • 11