Subject: [Jsonpath] [Errata Verified] RFC9535 (8343)
From: RFC Errata System <[email-masked]>
To: [email-masked], [email-masked], [email-masked], [email-masked]
Cc: [email-masked], [email-masked], [email-masked], [email-masked], [email-masked]
Date: Thu, 27 Mar 2025 11:30:22 -0700 (PDT)
List-Id: Discussion of JSONPath syntax <jsonpath.ietf.org>

The following errata report has been verified for RFC9535,
"JSONPath: Query Expressions for JSON". 

--------------------------------------
You may review the report below and at:
https://www.rfc-editor.org/errata/eid8343

--------------------------------------
Status: Verified
Type: Technical

Reported by: Vladimír Gorej <[email-masked]>
Date Reported: 2025-03-24
Verified by: Andy Newton (IESG)

Section: 2.4

Original Text
-------------
function-argument   = literal /
                      filter-query / ; (includes singular-query)
                      logical-expr /
                      function-expr

Corrected Text
--------------
function-argument   = logical-expr /
                      filter-query / ; (includes singular-query)
                      function-expr /
                      literal

Notes
-----
The ABNF grammars in RFC 9535 were designed to be directly usable with PEG (Parsing Expression Grammar) parsers.

However, PEG parsers will fail to parse $[?blt(1==1)] or $[?true(1)==0] with the grammar as given, as they employ prioritized choice, where the order matters.

In the order given, they will try to match the `literal` rule in `function-argument` with the input `1==1`, and find that the `1` indeed matches a `number`, completing the match for `function-argument` and preempting the other choices.  The intended rest of the `function-argument`, `==1` does not match anything, and the rule fails.
By putting the more complex `logical-expr` first, the whole `1==1` matches, and the rule succeeds as intended.

Similary, the function name `true` matches as the literal `true` instead, and preempts parsing `true(1)` as the more complex `function-expr`.  Putting the `literal` choice last prevents the preemptive match.

--------------------------------------
RFC9535 (draft-ietf-jsonpath-base-21)
--------------------------------------
Title               : JSONPath: Query Expressions for JSON
Publication Date    : February 2024
Author(s)           : S. Gössner, Ed., G. Normington, Ed., C. Bormann, Ed.
Category            : PROPOSED STANDARD
Source              : JSON Path
Stream              : IETF
Verifying Party     : IESG