v0.9.10 - A major reworking of the classic JSONPath
An extensive reworking of the original Javascript JSONPath engine by Stefan Gössner ("Goessner"), but keeping with ES5 syntax and functions for broad compatibility. Here are some highlights:
- It has a completely new "normalize" engine for better syntax enforcement: Unquoted key names are no longer allowed most notably but more importantly it now has better handling of complex expressions.
- Property names containing
],;, or that are syntactically identical to expressions like a single*or a filter expression(key)are all fully accessible with no confusion in the normalize engine. - Key names containing Unicode characters may also be accessed using
\uUnicode escape sequence. Property names containing\u0000-\u001fand\u007f, while very odd, will be properly\uescaped ifPATHorPATH_DOTTEDoutput if used for the value of theresultTypeproperty, additionally\uencoding for all Unicode characters in a property name can be enabled by setting theescapeUnicodeproperty - Unions can now handle key names with mixed quoting styles (single and double), multiple filter and script expressions, as well as multiple slice expressions.
- Slices now allow for negative step (reverse an array), negative array indices (truncation), as well as script expressions for creative array sampling (e.g. division)
- Strings can now be accessed by singular or multiple array indices for discreet character output as an array. They can also be sliced and maintain their stringiness.
resulType:"PATH"still outputs bracket style paths but now defaults to double quotes with single quotes being an option via thesingleQuoteKeysproperty. AdditionalresultTypeoptions have been added:PATH_DOTTEDfor dot style paths (when possible) andPATH_JSONPOINTERfor RFC 6901 JSON Pointer output- Script and filter expressions now check for disallowed function invocations and will terminate execution if functions other than
test()match()andexec()are found. This maintains compatibility with regex queries of the original however these methods should not need to be called now since we have the=~Ruby style regex operator that invokestest()behind the scenes; still, it's nice to have. ==and!=operators in script and filter expressions will evaluate as===and!==respectively, enforcing strict equality to ensure unexpected Javascript type coercion does not occur.- The addition of the [-] expression, borrowed from JSON Pointer to represent the next array index after the last. While this of no use to search and retrieval (it is always non-existent), it is beneficial for JSON creation tools to be able to add to the end of an array.