I am using PHP with the JSON extension function json_decode.
I have a JSON with a member named "1" (ie) { "1":"someda ta" }
Trying to access this via the -operator doesn't work, nor does
["1"].
Putting the JSON into a foreach loop DOES access the member:
foreach($json as $key=>$value) {
echo("$key<br />");
}
//outputs '1'
Is this an error on my part, an oversight in the PHP JSON
implementation, or something else? Why can foreach grab the members,
but I can't access them?
Thanks for your time!
Tyler
I have a JSON with a member named "1" (ie) { "1":"someda ta" }
Trying to access this via the -operator doesn't work, nor does
["1"].
Putting the JSON into a foreach loop DOES access the member:
foreach($json as $key=>$value) {
echo("$key<br />");
}
//outputs '1'
Is this an error on my part, an oversight in the PHP JSON
implementation, or something else? Why can foreach grab the members,
but I can't access them?
Thanks for your time!
Tyler
Comment