Repository navigation
Release 0.161.0
The jsoncons::jsonpath extension has been rewritten, see JSONPath extension revisited.
Enhancements to JSONPath extension
- Added a new function
make_expressionfor creating a compiled JSONPath expression for later evaluation. - The
json_queryandjson_replacefunctions now take an optionalresult_optionsparameter that allows duplicate values (i.e. values with
the same node paths) to be excluded from results, and for results to be sorted in path order.
Changes to json_query
-
The parameter
result_typehas been replaced by a bitmask typeresult_options.
For backwards compatability,result_typehas been typedefed toresult_options,
and thevalueandpathenumerators are still there. In addition,result_options
provides options for excluding duplicates from results, and for results to be sorted in
path order. -
Until 0.161.0,
json_querywas limited to returning an array of results, a copy.
With 0.161,json_queryallows the user to provide a binary callback
that is passed two arguments - the path of the item and a const reference to the
original item. -
Until 0.161.0,
json_replaceallowed the user to provide a unary callback to replace
an item in the original JSON with a returned value. This overload is still there, but has
been deprecated. With 0.161,json_replaceallows the user to provide a binary callback
that is passed two arguments - the path of the item and a mutable reference to the
original item.
Changes to supported JSONPath syntax
- Previous versions allowed optionally omitting the '$' representing the root of the
JSON instance in path selectors. This is no longer allowed. In 0.161.0, all path
selectors must start with either '$', if relative to the root of the JSON instance,
or '@', if relative to the current node. E.g.store.book.0is not allowed,
rather,$store.book.0. - Previous versions supported union of completely separate paths, e.g.
$..[name.first,address.city]. 0.161.0 does too, but requires that the
relative pathsname.firstandaddress.citystart with a '@', so the
example becomes$..[@.name.first,@.address.city]. - Previous versions supported unquoted names with the square bracket notation,
this is no longer allowed. E.g.$[books]is not allowed, rather$['books']
or$["books"]. - Previous versions allowed an empty string to be passed as a path argument
tojson_query. This is no longer allowed, a syntax error will be raised. - In 0.161.0, unquoted names in the dot notation are restricted to digits
0-9,
lettersA-Zanda-z, the underscore character_, and unicode coded characters
that are non-ascii. All others names must be enclosed with single or double quotes.
In particular, names with hypens (-) must be enclosed with single or double quotes.
Enhancements to JMESPath extension
- Function arity errors are now raised during compilation of the JMESPath expression
rather than during evaluation.