Tuesday, August 12, 2014

Json.NET 6.0, JSON Merge, JSONPath

Json.NET Updates: Merge, Dependency Injection, F# and JSONPath Support: @ InfoQ
"several new features have been added, including several F# specific features, support for JSONPath querying, ability to integrate with Dependency Injection frameworks, ability to Merge JSON objects and more."

James Newton-King - Json.NET 6.0 Release 4 - JSON Merge, Dependency Injection

JSONPath - XPath for JSON
The following XPath expression
would look like

JSONPath expressions can use the dot–notation
or the bracket–notation

Expressions of the underlying scripting language (<expr>) can be used as an alternative to explicit names or indices as in
using the symbol '@' for the current object. Filter expressions are supported via the syntax ?(<boolean expr>) as in
$.store.book[?(@.price < 10)].title

/$the root object/element
.@the current object/element
/. or []child operator
..n/aparent operator
//..recursive descent. JSONPath borrows this syntax from E4X.
**wildcard. All objects/elements regardless their names.
@n/aattribute access. JSON structures don't have attributes.
[][]subscript operator. XPath uses it to iterate over element collections and for predicates. In Javascript and JSON it is the native array operator.
|[,]Union operator in XPath results in a combination of node sets. JSONPath allows alternate names or array indices as a set.
n/a[start:end:step]array slice operator borrowed from ES4.
[]?()applies a filter (script) expression.
n/a()script expression, using the underlying script engine.
()n/agrouping in Xpath

No comments: