Hi everyone,
Let me first explain the idea:
I have a JSON document which has the following structure:
{
"timeline":
{
"headline":"Example Content",
"type":"default",
"text":"Example Content",
"startDate":"2013,1,1",
"endDate":"2013,1,28",
"date": [
{
"startDate":"2013,1,10",
"headline":"Example Content",
"text":"Example Content",
"asset":
{
"media":"Example Content",
"credit":"",
"caption":""
}
},
{
"startDate":"2013,1,14",
"headline":"Example Content",
"text":"Example Content",
"asset":
{
"media":"Example Content",
"credit":"",
"caption":""
}
},
{
"startDate":"2013,1,21",
"headline":"Example Content",
"text":"Example Content",
"asset":
{
"media":"Example Content",
"credit":"",
"caption":""
}
}
]
}
}
I want to be able to add the following sections using PHP that will get data from a database:
{
"startDate":"2013,1,14",
"headline":"Example Content",
"text":"Example Content",
"asset":
{
"media":"Example Content",
"credit":"",
"caption":""
}
},
Now people have been talking about json_encode() however, I am not quite sure 1) how to do this to achieve what I want and 2) whether that method would allow me to do what I want.
So basically could someone provide some help as to how to do it using json_encode() or if anyone knows of an alternative way, I would be happy to take all advice.
Thanks a bunch.
Jack