[{"Status":"FAILED","Message":"Trasaction Already Exist"}]
How to json_decode?
Currently using
$json=json_decode($response,true);
$status=$json["Status"];
$Message=$json["Message"];
but this is not working.
[{"Status":"FAILED","Message":"Trasaction Already Exist"}]
How to json_decode?
Currently using
$json=json_decode($response,true);
$status=$json["Status"];
$Message=$json["Message"];
but this is not working.
It is an array, you need to go to index 0
. Use print_r
or var_dump
in the future to see what you have.
$json = json_decode('[{"Status":"FAILED","Message":"Trasaction Already Exist"}]', TRUE);
$status=$json[0]["Status"];
$Message=$json[0]["Message"];
Example: https://3v4l.org/94BmB