从Groovy中的远程URL读取JSON文件 [英] Reading json file from remote url in groovy
本文介绍了从Groovy中的远程URL读取JSON文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设某些JSON文件为@ www.github.com/xyz/Hello.json,我想在Groovy的JSON对象中读取此JSON的内容
Suppose Some JSON file is @ www.github.com/xyz/Hello.json, I want to read this content of this JSON in JSON object in Groovy
推荐答案
然后,您需要:
import groovy.json.JsonSlurper
def slurped = new JsonSlurper().parse('www.github.com/xyz/Hello.json'.toURL())
此处,您可以找到更多信息.
Here you can find more info.
这篇关于从Groovy中的远程URL读取JSON文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文