ietf-wg-jsonpath / draft-ietf-jsonpath-base

Development of a JSONPath internet draft
https://ietf-wg-jsonpath.github.io/draft-ietf-jsonpath-base/
Other
58 stars 20 forks source link

Reasons behind "/" being an escapable character #462

Closed f3ath closed 1 year ago

f3ath commented 1 year ago

As per 2.3.1, the forward slash (/) must be escaped with a \ in name selectors. What are the reasons for this requirement?

cabo commented 1 year ago

Where do you see that it "must" be escaped? JSONPath copied the grammar for strings from JSON (adding single-quoted strings as an extra). JSON allows escaping slash characters (for cultural compatibility with the way JavaScript is included in <script elements in HTML). Escaping slashes never is needed to create correct JSON. Making use of the ability to escape slashes is convenient if the JSON text is then somehow used as JavaScript in an HTML <script element, which is probably no longer a significant way we use JSON texts.

f3ath commented 1 year ago

Thank you. I misread the spec.