Reputation: 504
I am unable to get array data between square bracket under curly bracket. This is json output:
{"data":{"user":[{"transaction":"45455","date":"2013-10-28" }],"msg":"ok"},"error":[]}
I have tried this:
$obj = json_decode($json_data, true);
$user_data_array = $obj['data']['user'];
But I am unable to get data in user array. Waiting for you quick reply and thanks in advance.
Upvotes: 1
Views: 2361
Reputation: 1667
I assume the "ok" in the message should be a string? Right now your json is invalid.
$json_data = '{"data":{"user":[{"transaction":"45455","date":"2013-10-28"}],"msg":"ok"},"error":[]}';
$obj = json_decode($json_data, true);
$user_data_array = $obj['data']['user'];
Upvotes: 1