for example if I have a simple JSON like this:
{
"data": [
"pets" : "none",
"parents": {"mom":"Anna", "dad":"Bob"},
"ancestors": { "children":[
{
"name": "Joe",
"age" : "10"
},
{
"name" : "Ron",
"age" : "4"
}
]}
]
}
and let's say I want to add a child "Jessica" of age "8" with PHP
how would i do that?
so far I know i need to use json_decode to access the JSON, json_encode to save something in it
but if I need to add a $newchild = array("name" : "Jessica", "age" : "8"); and add it how would it do it in data->ancestors->children ?