I'm trying to access "note_id" in a JSON object.
php code
<?php
$test =
'{"username":"Ellaleeeeeee",
"event_source":"browser",
"event":
"{
\"notes\": [{\"note_id\": \"2771\"}]
}"
}';
$jarray = json_decode($test, true);
$jevent = json_decode($jarray['event'], true);
var_dump($jevent);
?>
I tried $jevent['notes']['note_id'][0] but failed.
Please kindly tell me what I am supposed to do. Thanks!
$jarrayis already decoded, no need to decode it again in$jevent = ....$jevent = $jarray['event'];eventwhich was initially a string.$jevent['notes'][0]['note_id'].$jevent['notes'][0]['note_id']not$jevent['notes']['note_id'][0]