I am trying to get ID from this Json.
I have already tried many things such as:
- json_encode($array); and then trying to get value using
- $array->contact->id;
- $array['contact']['id]; BUT FAILED.
This is the response I get from active campaign API. I am using PHP, and the only issue I am facing is extracting ID from this Response.
How can I get contact --> id from the response? Can somebody help?
here's the code:`
{
"fieldValues": [
{
"contact": "113",
"field": "1",
"value": "The Value for First Field",
"cdate": "2020-08-01T10:54:59-05:00",
"udate": "2020-08-01T14:13:34-05:00",
"links": {
"owner": "https://:account.api-us1.com/api/3/fieldValues/11797/owner",
"field": "https://:account.api-us1.com/api/3/fieldValues/11797/field"
},
"id": "11797",
"owner": "113"
},
{
"contact": "113",
"field": "6",
"value": "2008-01-20",
"cdate": "2020-08-01T10:54:59-05:00",
"udate": "2020-08-01T14:13:34-05:00",
"links": {
"owner": "https://:account.api-us1.com/api/3/fieldValues/11798/owner",
"field": "https://:account.api-us1.com/api/3/fieldValues/11798/field"
},
"id": "11798",
"owner": "113"
}
],
"contact": {
"email": "johndoe@example.com",
"cdate": "2018-09-28T13:50:41-05:00",
"udate": "2018-09-28T13:50:41-05:00",
"orgid": "",
"links": {
"bounceLogs": "https://:account.api-us1.com/api/:version/contacts/113/bounceLogs",
"contactAutomations": "https://:account.api-us1.com/api/:version/contacts/113/contactAutomations",
"contactData": "https://:account.api-us1.com/api/:version/contacts/113/contactData",
"contactGoals": "https://:account.api-us1.com/api/:version/contacts/113/contactGoals",
"contactLists": "https://:account.api-us1.com/api/:version/contacts/113/contactLists",
"contactLogs": "https://:account.api-us1.com/api/:version/contacts/113/contactLogs",
"contactTags": "https://:account.api-us1.com/api/:version/contacts/113/contactTags",
"contactDeals": "https://:account.api-us1.com/api/:version/contacts/113/contactDeals",
"deals": "https://:account.api-us1.com/api/:version/contacts/113/deals",
"fieldValues": "https://:account.api-us1.com/api/:version/contacts/113/fieldValues",
"geoIps": "https://:account.api-us1.com/api/:version/contacts/113/geoIps",
"notes": "https://:account.api-us1.com/api/:version/contacts/113/notes",
"organization": "https://:account.api-us1.com/api/:version/contacts/113/organization",
"plusAppend": "https://:account.api-us1.com/api/:version/contacts/113/plusAppend",
"trackingLogs": "https://:account.api-us1.com/api/:version/contacts/113/trackingLogs",
"scoreValues": "https://:account.api-us1.com/api/:version/contacts/113/scoreValues"
},
"id": "113",
"organization": ""
}
}
`