Treeline.io - 如何从SendHTTPRequest解析json

时间:2015-04-23 15:31:34

标签: treeline

我从我的SendHTTPRequest

中检索json

enter image description here

看起来像这样(在浏览器中)

{
status: 200,
headers: "{"server":"nginx","date":"Thu, 23 Apr 2015 15:13:44 GMT","content-type":"application/json; charset=utf-8","transfer-encoding":"chunked","connection":"keep-alive","x-source":"redis","access-control-allow-origin":"*","access-control-allow-credentials":"true","access-control-allow-methods":"GET, POST"}",
body: "{"coord":{"lon":-0.13,"lat":51.51},"sys":{"message":0.0112,"country":"GB","sunrise":1429764429,"sunset":1429816225},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}],"base":"stations","main":{"temp":289.343,"temp_min":289.343,"temp_max":289.343,"pressure":1023.31,"sea_level":1031.3,"grnd_level":1023.31,"humidity":56},"wind":{"speed":1.52,"deg":110},"clouds":{"all":0},"dt":1429801539,"id":2643743,"name":"London","cod":200}"
}

不确定如何在ParseJSON机器中使用它

json:schema:究竟应该采用什么?

我收到状态:500内部服务错误。 (注意,我也尝试了发送HTTP请求主体变量,但后来我只看到一个空白的屏幕w /)

enter image description here

1 个答案:

答案 0 :(得分:2)

Parse JSON机器的schema输入允许任何类型,但看起来您希望它返回字典。目前没有办法将字典粘贴到输入中 - 你所做的是粘贴在字符串中,因此机器将返回一个字符串。如果你想让它返回一个字典,你必须自己指定它,首先擦除你粘贴到schema的字符串,然后键入一个{字符来启动字典,然后输入所有字典Parse JSON的结果输出应该具有的键和示例值。

同样,@ subiclebanana表示你可以通过点击它并选择其中一个属性来取消引用代表字典的气泡(例如“发送HTTP请求”的输出)。