[英]java json github-api git github pull-request loops get jsonpath parsing resttemplate spring spring-boot
I got a json
String from request of github api (/repos/:owner/:repo/pulls).
我从
github api (/repos/:owner/:repo/pulls).
请求中得到了一个json
字符串github api (/repos/:owner/:repo/pulls).
Then I parsed
it into a DocumentContext
using JsonPath.parse(json).
然后,我使用
JsonPath.parse(json).
其parsed
为DocumentContext
JsonPath.parse(json).
Now I want to iterate over my DocumentContext
using the read(path)
function, but the github api
does not have a size/length or amount of pull-requests. 现在,我想使用
read(path)
函数遍历我的DocumentContext
,但是github api
没有大小/长度或数量的拉取请求。
String json = https://api.github.com/repos/:owner/:repo/pulls
DocumentContext dc = JsonPath.parse(json)
for (int i = 0; i < dc.read($.somethingLikeSize); i++){
//get the objects
private int id = dc.read($.[i]...);
//...
}
As I guess, the open_issues_count or open_issues can be pull-requests, but they don't have to. 我猜想,open_issues_count或open_issues可以是请求请求,但它们不是必须的。
How can I iterate over my documentContext.read($.[i]...) without getting a PathNotFoundException
? 我如何在
documentContext.read($.[i]...) without getting a PathNotFoundException
遍历documentContext.read($.[i]...) without getting a PathNotFoundException
?
(PS: Please be gentle, I'm a newbie.) (PS:请保持温柔,我是新手。)
String json = "...";
DocumentContext dc = JsonPath.parse(json);
List<String> listOfValues = dc.read("$.[?].key");
then you can iterate over listOfValues
那么你可以遍历
listOfValues
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.