Replies: 2 comments
-
Hi @rob-ross, There's an open invitation to a Slack workspace in this Building a JSON Path community discussion, but it has very little activity. You might get a better response to specific spec related questions by opening an issue on https://github.com/ietf-wg-jsonpath/draft-ietf-jsonpath-base. The spec authors have been very helpful in the past. And you are welcome to ask any Python related questions here or here. Note that python-jsonpath-rfc9535 is a cleaner implementation than this project. It follows the spec more closely and is a much better example of a hand-crafted, pure Python parser.
The JSONPath standard is more strict than most JSON libraries/packages when it comes to decoding escape sequences inside strings. Even For strict JSONPath compliance you'd need to implement string unescaping yourself. This Rosetta Code tasks shows exactly that. And once you've decoded a string literal, the only time you'd want to replace unescaped code points with escape sequences is if you're serializing a canonical path or normalized path. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the pointers. I solved my quoting issue. I also (finally) discovered I didn't have any actual problems in my descendant-segment code after all. I just recently added Sequence to the types I accept for processing arrays, and that was treating string values as arrays, causing extra output nodes to be generated incorrectly. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello.
I've been working on a Python implementation of RFC 9535. I'm nearly complete, and so I've started looking at what other people have done. Your project looks impressive. I've already learned a few things, such as the existence of the various compliance testing data suites.
My purpose with my own project was two-fold. I'm really a "java guy" and so wanted to develop a Python project that would force me to really learn Python libraries and idioms. Also, I had been working with JSON exports of wiktionary data and was trying to use json-path for some data analysis, and I was disappointed with the inconsistencies and lack of documentation of the "leading" providers of the json–path query implementation. (Pre-RFC standard).
There are some things I'm unclear about the spec, and although the test suites can give me guidance on what a method is supposed to return in a given context, I'd still like to understand the spec in greater detail. I'm currently failing many of the 'quoting' tests. I know how to unescape string literals that are supposed to be name selectors, and I have regex to check that the quoting of embedded strings is correct. But I am confused about when I'm supposed to do the opposite... re-encode those strings. I had assumed that a json encoding library like the built in json package in Python would take care of encoding strings according to the JSON spec.
I also seem to have a subtle bug in my descendent segment processing. I pass most of the tests but am still failing 2.
So these are examples of questions I have that I would like to ask in some RFC 9535 related forum or discord channel, etc.
If you can point me in the right direction I would appreciate it!
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions