Hello i want to convert this JSON to PHP:
data = {
rows: [{
id: 1001,
data: ["100", "A Time to Kill", "John Grisham", "12.99", "1", "05/01/1998"]
}, {
id: 1002,
data: ["1000", "Blood and Smoke", "Stephen King", "0", "1", "01/01/2000"]
}]
}
Any Suggestions how to?
After Many Hours of figuring out i finally solved it
$data.='
{id:'.$rows['ID'].',
data:["'.$rows['Price'].'","'.$rows['Title'].'","'.$rows['author'].'","'.$rows['date'].'"]
},';
This is what i meant of converting :)
json_decode is your friend.
you should use some json parser in php and map your json data to some object; you can use json_decode (remember json is data structure but php is a programming language(script actually) so converting json to php is meaningless.)