【发布时间】:2018-06-17 13:56:47
【问题描述】:
我一直在努力尝试在网上找到一种方法来成功解析来自 API 请求的 JSON 输出。
我正在寻找解析以下 API JSON 示例输出的“ResultData”部分:
{"url":"http://elasticbeanstalk.com/api/results/69/","id":69,"user":3,"inputdata":{"Q1":"Response1","Q2":"Response2","Q3" :"Response3","Q4":"Response4","Q5":"Response5"},"ResultData":"{\"index\":1551,\"ID\":5246,\"Attribute1\": \"Output1\",\"Attribute2\":\"Output2",\"Attribute3\":16,\"Attribute4\":62.9433099,\"Attribute5\":\"www.google.com.au\" }\n {\"index\":1551,\"ID\":5246,\"Attribute1\":\"Output1\",\"Attribute2\":\"Output2",\"Attribute3\":16 ,\"Attribute4\":62.9433099,\"Attribute5\":\"www.google.com.au\"}\n {\"index\":1551,\"ID\":5246,\"Attribute1\ ":\"Output1\",\"Attribute2\":\"Output2",\"Attribute3\":16,\"Attribute4\":62.9433099,\"Attribute5\":\"www.google.com.au \"}\n {\"index\":1551,\"ID\":5246,\"Attribute1\":\"Output1\",\"Attribute2\":\"Output2",\"Attribute3\" :16,\"Attribute4\":62.9433099,\"Attribute5\":\"www.google.com.au\"}\n {\"index\":1551,\"ID\":5246,\" Attribute1\":\"Output1\",\"Attribute2\":\"Output2",\"Attribute3\":16,\"Attribute4\":62.9433099,\"Attribute5\":\"www.google.com .au\"}\n {\"索引\":1551,\"ID\ ":5246,\"Attribute1\":\"Output1\",\"Attribute2\":\"Output2",\"Attribute3\":16,\"Attribute4\":62.9433099,\"Attribute5\":\ "www.google.com.au\"}\n {\"index\":1551,\"ID\":5246,\"Attribute1\":\"Output1\",\"Attribute2\":\" Output2",\"Attribute3\":16,\"Attribute4\":62.9433099,\"Attribute5\":\"www.google.com.au\"}\n {\"index\":1551,\" ID\":5246,\"Attribute1\":\"Output1\",\"Attribute2\":\"Output2",\"Attribute3\":16,\"Attribute4\":62.9433099,\"Attribute5\" :\"www.google.com.au\"}\n {\"index\":1551,\"ID\":5246,\"Attribute1\":\"Output1\",\"Attribute2\": \"Output2",\"Attribute3\":16,\"Attribute4\":62.9433099,\"Attribute5\":\"www.google.com.au\"}"}
希望导出到谷歌表格的每一行的以下值:
索引 ID Attribute1 Attribute2 Attribute3 Attribute4 Attribute5
有什么想法吗?任何正确方向的帮助或指示将不胜感激!
【问题讨论】:
标签: json parsing google-apps-script google-sheets-api jsonparser