I am working against an API that gives me a stdClass object that looks like this (actual data replaced)
"data": [
{
"type": "image",
"comments": {
"data": [
{
"created_time": "1346054211",
"text": "Omg haha that a lot of squats",
"from": {},
"id": "267044541287419185"
},
{
"created_time": "1346054328",
"text": "Fit body",
"from": {},
"id": "267045517536841021"
},
]
},
"created_time": "1346049912",
},
How can I create a stdClass object, for example, "Comments", which have several subfields with the same name and different data. When I try to create a stdClass that looks like this, my comment section will only contain 1 input, which is the last in the while loop. Therefore, instead of applying to the bottom, it replaces the old data with the new. How to fix it?
source
share