0
我已將Hubot與elasticsearch和slack集成。 當我們在API上查詢時,我們使用郵遞員時以JSON格式獲取輸出。如何使用Coffeescript獲取JSON輸出?
當我們使用coffeescript從懈怠中查詢時,我們得到的是簡單的輸出。 下面是代碼
showHealth = (msg) ->
msg.send("Getting the health for the cluster: ")
msg.http("http://show-acc.com/_cluster/health/")
.get() (err, res, body) ->
lines = body.split("\n")
header = lines.shift()
list = [header].concat(lines.sort().reverse()).join("\n")
msg.send("/code \n ```#{list}```")
這是印刷我在農閒純輸出。 請問任何人都可以幫助我如何更改代碼以JSON格式打印輸出?