I Want to create an JSON file in the following format. I'm new to the JSON so i can't get how to create this data displayed in the JSON format. Thanks in advance
{
"data": [
[
"Tiger Nixon",
"System Architect",
"Edinburgh",
"5421",
"2011\/04\/25",
"$320,800"
],
[
"Garrett Winters",
"Accountant",
"Tokyo",
"8422",
"2011\/07\/25",
"$170,750"
],
[
"Ashton Cox",
"Junior Technical Author",
"San Francisco",
"1562",
"2009\/01\/12",
"$86,
000"
],
[
"Donna Snider",
"Customer Support",
"New York",
"4226",
"2011\/01\/25",
"$112,000"
]
]
}
You can start like this :
$str = '{
"data": [
[ "Tiger Nixon", "System Architect", "Edinburgh", "5421", "2011\/04\/25", "$320,800" ],
[ "Garrett Winters", "Accountant", "Tokyo", "8422", "2011\/07\/25", "$170,750" ],
[ "Ashton Cox", "Junior Technical Author", "San Francisco", "1562", "2009\/01\/12", "$86,000" ],
[ "Donna Snider", "Customer Support", "New York", "4226", "2011\/01\/25", "$112,000" ]
]
}';
$json = json_decode($str);
$res = $json->{'data'};
foreach($res as $data) {
echo "<pre>";
print_r($data);
}