When trying to access an API the JSON array must be parsed like this
{"item":[{"id":"123456", "name":"adam"}]}
But when i'm doing the following code
$data = array("item" => array("id" => "123456", "name" => "adam"));
echo json_encode($data);
it returns the json array without squared brackets as follows
{"item":{"id":"123456","name":"adam"}}
I've spent hours trying to figure out how to fix this and just can't think of a solution
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…