php json_decode fails without quotes on key

后端 未结 8 1919
故里飘歌
故里飘歌 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

    $results = \Symfony\Component\Yaml\Yaml::parse("{a: d, b: 'c', e: [a, 3]}");
    

    You probably can only use that lib without having to use the whole Symfony package : https://packagist.org/packages/symfony/yaml

提交回复
热议问题