A leading $ decides JSONPath from property path
The rule
Normative: this is the rule
- A path is a JSONPath query if and only if the string, once trimmed of surrounding whitespace, begins with
$. - Every other path is a property path.
What it means
The choice between the two engines is a syntactic sniff of the string
itself, not a guess informed by what the string looks like it is trying to
do. Trimming first means a $ preceded only by whitespace still counts —
the query is a JSONPath query even though the raw string does not start
with the character. Everything else, including a string that uses JSONPath's
own bracket punctuation without a leading $, is read as a property path.
Example
Two strings handed to the same check: one with a leading space before the
$, one in bracket notation with no $ anywhere in it.
" $.users""[users][0][name]"Rule identifiers are permanent and are never renumbered. Each implementation publishes its own standing against these rules; this specification does not.spec 1.0-draft · LANG-14 · changed in spec 1.0