I have some data from database which is like:
$name= "xxx";
$title= "xxx";
$arrayGender = array("Boy","Girl");
$arrayName = array("John", "Rosy");
How do I encode the data to a json object, so i guess the json would be something like:
{
"name":"xxx",
"title":"xxx",
"children":[{"Boy","John"},{"Girl","Rosy"}]
}