1.9.07 # JSONPath - XPath for JSON
Here and there on the web we can find a discussion or solution for something like XPath for JSON. Despite the fact, that JSON structures can be processed by the C family of programming languages quite easily, there should be a benefit in having some kind of XPath4JSON.
So I was thinking about a suitable path expression syntax for addressing portions of any JSON structure. Those path expressions should
- be naturally based on C language family characteristics.
- cover only essential parts of XPath 1.0.
As a result here is JSONPath, wich is a dual thing. Primarily JSONPath is a path expression syntax, which can select parts of JSON structures in the same way as XPath expressions select nodes of XML documents. Such an expression may look like
and is quite similar to its XPath counterpart
Currently there is a small set of nine JSONPath syntax elements, which allows the construction of sophisticated path expressions.
You can download
for free and read more about it.
For example $['node\.name'] does not work in selecting the "node.name" key in the array. Any chance that basic escaping could be added?
Actually there is no escaping mechanism implemented (theoretically necessary only for [' ; #]).
I've a java project that implements JSONPath but I've some doubt