-4

I have output file json but i can't read the properties in array [0]

 contacts: 
      Array(20)
                0: 
                 canonical-vid:00000
                 form-submissions:[]
                 identity-profiles:[{…}]
                 is-contact:true
                 merge-audits:[]
                 merged-vids:[]
                 portal-id:000000
                 properties:{....}

I use this code in php :

    $json = file_get_contents('./file,json');

    $data = json_decode($json,true);

    $firstname = $data['contacts'][0]['properties']['firstname']['value'];

1 Answers1

0

I think $data['contacts'][0]['properties'] is json. Try like this:

$properties = $data['contacts'][0]['properties'];
$nameData = json_decode($properties,true);
Zahra Badri
  • 1,656
  • 1
  • 17
  • 28