由于SyntaxError,json_decode为空数组

时间:2017-05-07 10:51:46

标签: php json string decode

我有以下Json文件:

{ 
  "id": "04d925a8-c62a-4c28-83eb-21bfb879583a",
  "timestamp": "2017-05-07T10:23:05.165Z",
  "lang": "en",
  "result": {
    "source": "agent",
    "resolvedQuery": "fever",
    "action": "d",
    "actionIncomplete": false,
    "parameters": {
      "Disease": [
        "influenza"
      ],
      "Interest": "",
      "Search": "",
      "sick": "",
      "Symptom": [
        "Headache",
        "Stomach ache",
        "fever"
      ],
      "Use": "No"
    },
    "contexts": [],
    "metadata": {
      "intentId": "49ebecd7-4efd-421b-868e-5a97637ef749",
      "webhookUsed": "false",
      "webhookForSlotFillingUsed": "false",
      "intentName": "Doctor"
    },
    "fulfillment": {
      "speech": "I think you possible have the influenza with symptoms Headache, Stomach ache and fever, influenza, Headache, Stomach ache and fever",
      "messages": [
        {
          "type": 0,
          "speech": "I think you possible have the influenza with symptoms Headache, Stomach ache and fever, influenza, Headache, Stomach ache and fever"
        },
        {
          "type": 4,
          "payload": {
            "Google": {
              "attachment": {
                "type": "",
                "payload": {}
              }
            },
            "kik": {
              "type": "",
              "body": ""
            },
            "slack": {
              "text": "",
              "attachments": []
            },
            "telegram": {
              "text": ""
            },
            "viber": {
              "type": "text",
              "text": ""
            }
          }
        }
      ]
    },
    "score": 1
  },
  "status": {
    "code": 200,
    "errorType": "success"
  },
  "sessionId": "ba024d91-b309-4fa7-919c-6780e77f57e5"
}

但是当我在php中json_decode时它会给我一个空数组。这意味着Json格式正确。所以我在JsonLint json验证器网站上检查了我的json。我得到了SyntaxError: Bad string on line 1这是json文件的第一个大括号。为什么这不正确?或者我的json中有其他错误吗?因为我似乎无法找到问题。任何帮助是极大的赞赏。

0 个答案:

没有答案