I have this Json(see below) and I am trying actually to find a way to generate one like this using a php array. My question is how can I generate a json like this from a php array. in another way, I still don't know how to build that php array so that I can convert it to this a json like the one below. I am using symfony2 to render this a json like this one
var presentation = [{
"image": "images/cover.jpg",
"sentence": "This is a sentence",
"audio": "hello.mp3",
"sentence_info": [
{"start": 0, "end": 0.5 },
{ "start": 0.5, "end": 1.2 }
]
},
{
"image": "images/cat.jpg",
"sentence": "This is another sentence",
"audio": "bey.mp3",
"sentence_info": [
{ "start": 0, "end": 0.2 },
{ "start": 0.2, "end": 0.8 },
{ "start": 0.8, "end": 1.2 },
{ "start": 1.2, "end": 1.5 },
{ "start": 1.5, "end": 2 }
]
},
{
"image": "images/dog.jpg",
"sentence": "This is a third sentence",
"audio": "good.mp3",
"sentence_info": [
{ "start": 0, "end": 0.5 },
{ "start": 0.5, "end": 1.2 }
]
}
];