PHP json_decode for key with non-alphanumeric character

Suppose your JSON data has a key like "@id" ... with a non-alphanum character... How do you reference it via php json_decode?

->"@id" and ->'@id' don't seem to work...

Answer1:

Same as always.

$decoded_json->{'@id'}

人吐槽 人点赞

Recommend

Comment

用户名: 密码:
验证码: 匿名发表

你可以使用这些语言

查看评论:PHP json_decode for key with non-alphanumeric character