java: xpath on json [closed]
开发者_运维问答
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this questionI need a fast way to extract data from json responses a I get from a webservice.
By fast, I mean fast for the programmer, not necessarily for the computer.
I was thinking of something like Xpath for Json, if such a thing exists.
Any ideas? I am open to any Java Json library. In fact, the easiness to extract data from Json with a powerful querying language will be central to the choice of json library.
Jackson JSON Processor has been used in a lot of frameworks. The tree model or data binding approach is probably the easiest to work with.
JsonPath emerged as a de facto standard for such tasks. A Java implementation:
https://github.com/nebhale/JsonPath
It seems well maintained and works fine.
https://github.com/jayway/JsonPath
Similar to @alexis-dufrenoy's answer -- but it looks like a more active project.
Disclaimer: I have not tried @nebhale's system, so I can't judge which is best.
精彩评论