如何在我的 DialogFlow 请求中找到 JSON 错误?
How can I find the JSON error in my DialogFlow request?
我正在将以下意图创建 json 发送到 DialogFlow API hook 并不断收到错误 "JSON syntax error"。有什么方法可以获得更详细的错误描述?
{
"templates": [],
"lastUpdate": 1508084934,
"fallbackIntent": "false",
"name": "address-intent",
"contexts": [
"order-intent-order-done-confirm-followup"
],
"auto": "true",
"webhookUsed": "true",
"events": [],
"priority": 500000,
"userSays": [
{
"count": 0,
"isTemplate": "false",
"data": [
{
"text": "deliver to ",
"userDefined": "false"
},
{
"text": "washington square",
"meta": "@sys.address",
"userDefined": "false",
"alias": "address"
}
]
},
{
"count": 0,
"isTemplate": "false",
"data": [
{
"text": "please deliver it to ",
"userDefined": "false"
},
{
"text": "washington square",
"meta": "@sys.address",
"userDefined": "false",
"alias": "address"
}
]
},
{
"count": 0,
"isTemplate": "false",
"data": [
{
"text": "34 1st street",
"meta": "@sys.address",
"userDefined": "false",
"alias": "address"
}
]
},
{
"count": 0,
"isTemplate": "false",
"data": [
{
"text": "deliver it to ",
"userDefined": "false"
},
{
"text": "washington square",
"meta": "@sys.address",
"userDefined": "false",
"alias": "address"
}
]
}
],
"webhookForSlotFilling": "false",
"responses": [
{
"affectedContexts": [
{
"name": "address-intent-followup",
"parameters": {},
"lifespan": 1
}
],
"parameters": [
{
"name": "address",
"dataType": "@sys.address",
"required": "true",
"value": "$address",
"prompts": [
{
"lang": "en",
"value": "What's the address for the delivery?"
},
{
"lang": "en",
"value": "Where should we send the order to?"
},
{
"lang": "en",
"value": "What's your address?"
}
],
"isList": "false"
}
],
"messages": [
{
"lang": "en",
"speech": [],
"type": 0
}
],
"defaultResponsePlatforms": {},
"action": "address-intent",
"speech": [],
"resetContexts": "false"
}
]
}
需要说明的是,其他意图创建请求有效(以及获取请求),所以我很确定我的 JSON 中的某些内容是错误的。 JSON 是有效的 JSON(已验证 here)
您提供的 JSON 是 Dialogflow 将在您的 webhook 请求正文中发送到您的 webhook 的 JSON。要响应您的用户,您必须使用如下所示的响应来响应此请求:
Headers:
Content-type: application/json
Body:
{
"speech": "Barack Hussein Obama II was the 44th and current President of the United States.",
"displayText": "Barack Hussein Obama II was the 44th and current President of the United States, and the first African American to hold the office. Born in Honolulu, Hawaii, Obama is a graduate of Columbia University and Harvard Law School, where ",
"data": {...},
"contextOut": [...],
"source": "..."
}
data
、contextOut
和 source
属性是可选的。 speech
和 displayText
是必需的,分别对应于向用户说出和显示的内容。
这是 prompts
合集。
它应该是一个字符串列表而不是对象列表。
一个体面的错误消息会很好。
我正在将以下意图创建 json 发送到 DialogFlow API hook 并不断收到错误 "JSON syntax error"。有什么方法可以获得更详细的错误描述?
{
"templates": [],
"lastUpdate": 1508084934,
"fallbackIntent": "false",
"name": "address-intent",
"contexts": [
"order-intent-order-done-confirm-followup"
],
"auto": "true",
"webhookUsed": "true",
"events": [],
"priority": 500000,
"userSays": [
{
"count": 0,
"isTemplate": "false",
"data": [
{
"text": "deliver to ",
"userDefined": "false"
},
{
"text": "washington square",
"meta": "@sys.address",
"userDefined": "false",
"alias": "address"
}
]
},
{
"count": 0,
"isTemplate": "false",
"data": [
{
"text": "please deliver it to ",
"userDefined": "false"
},
{
"text": "washington square",
"meta": "@sys.address",
"userDefined": "false",
"alias": "address"
}
]
},
{
"count": 0,
"isTemplate": "false",
"data": [
{
"text": "34 1st street",
"meta": "@sys.address",
"userDefined": "false",
"alias": "address"
}
]
},
{
"count": 0,
"isTemplate": "false",
"data": [
{
"text": "deliver it to ",
"userDefined": "false"
},
{
"text": "washington square",
"meta": "@sys.address",
"userDefined": "false",
"alias": "address"
}
]
}
],
"webhookForSlotFilling": "false",
"responses": [
{
"affectedContexts": [
{
"name": "address-intent-followup",
"parameters": {},
"lifespan": 1
}
],
"parameters": [
{
"name": "address",
"dataType": "@sys.address",
"required": "true",
"value": "$address",
"prompts": [
{
"lang": "en",
"value": "What's the address for the delivery?"
},
{
"lang": "en",
"value": "Where should we send the order to?"
},
{
"lang": "en",
"value": "What's your address?"
}
],
"isList": "false"
}
],
"messages": [
{
"lang": "en",
"speech": [],
"type": 0
}
],
"defaultResponsePlatforms": {},
"action": "address-intent",
"speech": [],
"resetContexts": "false"
}
]
}
需要说明的是,其他意图创建请求有效(以及获取请求),所以我很确定我的 JSON 中的某些内容是错误的。 JSON 是有效的 JSON(已验证 here)
您提供的 JSON 是 Dialogflow 将在您的 webhook 请求正文中发送到您的 webhook 的 JSON。要响应您的用户,您必须使用如下所示的响应来响应此请求:
Headers:
Content-type: application/json
Body:
{
"speech": "Barack Hussein Obama II was the 44th and current President of the United States.",
"displayText": "Barack Hussein Obama II was the 44th and current President of the United States, and the first African American to hold the office. Born in Honolulu, Hawaii, Obama is a graduate of Columbia University and Harvard Law School, where ",
"data": {...},
"contextOut": [...],
"source": "..."
}
data
、contextOut
和 source
属性是可选的。 speech
和 displayText
是必需的,分别对应于向用户说出和显示的内容。
这是 prompts
合集。
它应该是一个字符串列表而不是对象列表。
一个体面的错误消息会很好。