JSON数组不会解码?

时间:2013-03-17 17:24:48

标签: php json

JSON显然看起来像这样。

    {\"amount\":10,\"conversion_id\":\"5145fd4e04af9\",\"extra_params\":
    {\"ip\":\"99.237.185.67\",\"user_agent\":\"Mozilla/5.0 (Windows NT 6.1; WOW64) 
    AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 
    Safari/537.11\"},\"job_title\":\"Answer a few questions about a website (Canada - 
    Sunday task #1) (Canada Only)\",\"adjusted_amount\":8.0}

但是json_decode在php中不起作用。 HELP ???

1 个答案:

答案 0 :(得分:3)

这不是有效的JSON。在JSON中,必须使用"引用键,因此您的JSON内容将是

{
    "payload": {
        "conversion_id": "32402345984532934511",
        "amount": 50,
        "adjusted_amount": 25,
        "job_title": "The title of the last job they completed (and 2 other jobs)"
    },
    "signature": "1221299611f823b8c30a347373b449ad"
}

另见http://json.org