Currently I have the below JSON as my out put from my php function (also below). However, I need the initial brackets for name list to change from [] to {}. I see this kind of output with actual APIs but I cannot figure out how to make this happen. Any suggestions? JSON Output file:
{
"nameList": [
{
"id": 1,
"Name": "Test",
"Amount": 0,
"Location": "Test"
}
]
}
PHP Code:
$json = json_encode(array("nameList" => array($MySQL->ReturnDataArray("*","names","WHERE Location = '". $Location ."'")), JSON_PRETTY_PRINT);
file_put_contents('/assets/server/output.json', $json);