Im not sure if this would be considered proper format of a json structure. Essentially what Im trying to have is an array of associative arrays. My json data:
{
"notifications": [{
"notificationid": "7hstyans",
"notificationtitle": "Some alert title",
"notificationtype": "SPECIAL ALERT",
"dateCreated": "1502203175"
}, {
"notificationid": "9ksh7dh2",
"notificationtitle": "This is a old notification",
"notificationtype": "OLD ALERT",
"dateCreated": "1502138431"
}, {
"notificationid": "iksnudo3",
"notificationtitle": "new notification",
"notificationtype": "SOME ALERT",
"dateCreated": "1501000523"
}]
}
I am looking for a way to access it such as data.notifications[0]["notificationid"]
Would this be considered the correct format for json and the correct way to access it or what would be the best approach to format this?
json_decode, either to associative array, or tostdClass. But : not both as you have it here. Pick one, decode your json, then use the appropriate syntax for the decode-style you picked.