I want to retrieve a value out of a nested JSON file with PHP. I created the following code:
<?php
$string = file_get_contents("https://api.abc");
$json = json_decode($string,true);
foreach ($json['contacts'][0]['properties']['company'] as $person) {
echo $person['value'];
}
?>
It will only give me 1 result and only the first letter of the value. How do I get more results and more than just the first letter?
{
"contacts": [{
"addedAt": 1414182103652,
"vid": 2,
"canonical-vid": 2,
"merged-vids": [],
"portal-id": 448845,
"is-contact": true,
"properties": {
"firstname": {
"value": "Andre"
},
"lastmodifieddate": {
"value": "1472024018755"
},
"company": {
"value": "test"
},
"lastname": {
"value": "Jansen"
}
},