php json_decode fails without quotes on key

后端 未结 8 1920
故里飘歌
故里飘歌 2020-12-06 06:26

I have json data represented like this

{key:\"value\"}

(no quotes arround key...)

I want to translate it to an associative array.

8条回答
  •  旧巷少年郎
    2020-12-06 06:53

    As per the documentation (see Example #3 - 'common mistakes using json_decode'), keys must be enclosed in double quotes.

    Where are you getting the JSON data?

提交回复
热议问题