Enge Enge - 1 year ago 127
JSON Question

JSON Decode (PHP)

how can I Select the value of "success" from that json?:

"response": {
"success": true,
"groups": [
"gid": "3229727"
"gid": "4408371"


Thats my current code:

$result = json_decode ($json);
$success = $result['response'][0]['success'];
echo $success;

Thank you.

Answer Source

You are almost near to solution. place "true" as second argument for json_decode().

Eg: $result = json_decode ($json, true); $result['response']['success']; -> to get the value of success.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download