JSONPath in Dojo
18 March 2008JSONPath has landed in the Dojo Toolkit 1.1, and I have recently added some bug fixes and improvements to the Dojo implementation of JSONPath. You can read more details here, but two substantial features were added:
- Result-Based Evaluation - Result-based evaluation uses a more intuitive form of evaluation that follows JavaScript (and other languages) evaluation more closely. Peforming a JSONPath query that references a property will return that property, rather than returning an array with a single item with the value of the property.
- Safe-Evaluation - The original JSONPath specification does not provide any limitations on the sub-expressions, rather allowing any JavaScript expression. This means arbitrary JavaScript can be executed, and it also prevents portability due to it’s inherent reliance on a JavaScript engine. Safe-evaluation limits the operators in sub-expressions to facilitate portability and prevent unsafe, arbitrary code execution. This feature will probably be added in Dojo 1.2.
JSONPath queries in Dojo can be executed like this:
dojo.require("dojox.jsonPath");...dojox.jsonPath.query(object,query,options)
No comments yet