预期输出:
{
"id": "6ae5f723-538f-4df8-ad9a-88943b28484d-ee7586fb",
"lang": "en",
"session_id": "dfMessenger-12848231",
"timestamp": "2020-11-06T06:46:50.794Z",
"result": {
"source": "agent",
"resolved_query": "WELCOME",
"action": "input.welcome",
"score": 1,
"parameters": {},
"contexts": {
"name": "awaits_choice",
"lifespan": 5,
"parameters": {}
},
"metadata": {
"intent_id": "5bb77027-405a-401e-ac3f-497c471359c8",
"intent_name": "Default Welcome Intent",
"webhook_used": "false",
"webhook_for_slot_filling_used": "false",
"is_fallback_intent": "false"
},
"fulfillment": {
"speech": "Hi, I’m sathish",
"messages": {
"payload": {
"fields": {
"key": "richContent",
"value": {
"list_value": {
"values": {
"list_value": {
"values": {
"struct_value": {
"fields": {
"key": "type",
"value": {
"string_value": "chips"
}
}
}
}
}
}
}
}
}
},
"lang": "en",
"type": {
"number_value": 4
}
}
}
},
"status": {
"code": 200,
"error_type": "success"
}
}
上面是我的字符串,我想使用node.js形成一个有效的json字符串。有人可以帮我形成 json 字符串吗?提前致谢。我尝试使用正则表达式替换,但对我不起作用。我已经浪费了两天时间来形成一个完美的 json 来显示值。我非常需要有人帮助我解决这个问题。
倚天杖
相关分类