Subject: [Jsonpath] Canonical Normalized Paths

From: Glyn Normington <[email-masked]>
Date: Tue, 1 Feb 2022 18:25:11 +0000

A normalized path is a JSONPath expression which identifies a specific
node in a given JSON document. The main use case is for JSONPath
implementations that return normalized paths instead of, or in addition to,
the values identified by these paths.

PR 152 has generated some discussion of normalized paths and whether to
nail these down into a canonical form.

The other extreme would be to allow a normalised path to be any JSONPath
expression which identifies a specific node in a given JSON document. This
could include expressions such as:

* $.a
* $['a']
* $["a"]
* $['\u0061']
* $["\u0061"]

all of which are equivalent, regardless of the JSON document they are used
to query. It could also include the, admittedly unlikely, expression $[-1].

Before the editors go further, I wanted to check that there is a consensus
in principle for a canonical form.

[1]
https://github.com/ietf-wg-jsonpath/draft-ietf-jsonpath-base/pull/152/files

---

From: Julian Reschke <[email-masked]>
Date: Tue, 1 Feb 2022 19:35:31 +0100

Am 01.02.2022 um 19:25 schrieb Glyn Normington:
> implementations that return normalized paths instead of, or in addition
> to, the values identified by these paths.
>
> expression which identifies a specific node in a given JSON document.
 > ...

Wouldn't that mean that if a JSONPath expression identifies a single
node, a conforming implementation could just return that expression as
"normalized" path (no matter how complex it may have been)?

Best regards, Julian