A string context is parsed as JSON where it parses
The rule
Normative: this is the rule
- Where the evaluation context is a string, it is parsed as JSON and the parsed value is what the path queries.
- A string that is not valid JSON is used as-is.
- The string
nullparses to null, like any other JSON document.
What it means
Whether a string context is parsed turns entirely on whether it parses, not on whether it looks like ordinary text or looks like data. The sharp edge is the four-character string "null": it reads like the kind of text a pass-through would leave alone, but it is itself a complete, valid JSON document, so it decodes to the JSON value null rather than surviving as the four-letter word. Nothing about the surrounding path decides this — the context alone does.
Example
The context is a string in both cases; only whether it parses as JSON decides what querying the root returns.
"null"null"{\"name\": \"Test\", \"value\": 123}""Test"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-16 · changed in spec 1.0