4 ms·
JavaScript Object Notation (JSON) Pointer (2013)
- stefankuehnel 4y agoAbstract JSON Pointer defines a string syntax for identifying a specific value within a JavaScript Object Notation (JSON) document.
- jupp0r 4y ago"Note that JSON pointers can contain the NUL (Unicode U+0000) character. Care is needed not to misinterpret this character in programming languages that use NUL to mark the end of a string." What could possibly go wrong?
- zerocrates 4y agoI wonder why it allows NUL... I'm pretty sure JSON itself doesn't: you need to do a \u escape to do the control characters including NUL. It looks like that kind of escaping is just not supported at all in JSON Pointer. I kind of want to say that once you've noticed NUL is a problem enough to call it out the document, you should probably just ban it and pop in an escape to represent it.
- 2h 4y ago2013
- hyperhello 4y agoI’m guessing no one wanted this, because stepping into JSON with forward slashes is trivial if you wanted to do it, and no one would do that. Making a standardized “safe” JSON query like json.array[3][“baz”] that is JS compatible might be interesting, but still really trivial to do.
- thadk 4y agoIf you don't need multi-language support, it seems like there may be more natural ways to point at a particular part of a JSON object. This issue has a few different implementations and alternatives: https://github.com/akheron/optics-ts/issues/241 https://github.com/akheron/optics-ts/issues/241
- nighthawk454 4y agoI was wondering how this differs from JSONPath, found some answers on google: > jsonpointer just defines how to access to a single value inside a json document, whereas jsonpath has more powerful features like union (extract multiple values), filters and deep search (recursively match a path). > But jsonpath is missing a proper specification, so some behaviors are implementation specific with some parts heavily depending on some javascript constructs (mainly filters). https://github.com/yalp/jsonpath/issues/1#issuecomment-137081081 https://github.com/yalp/jsonpath/issues/1#issuecomment-13708...
- beached_whale 4y agoA simple subset of JSONPath is nice, it looks just like code. e.g foo.bar[5].value and encodes that we expect a member name or a indice into the array or class. It’s common to have numeric string member names in JSON when dealing with associative structures of KV pairs.
- fanf2 4y agoThere is an IETF working group developing a spec for jsonpath https://datatracker.ietf.org/wg/jsonpath/documents/ https://datatracker.ietf.org/wg/jsonpath/documents/
- oweiler 4y agoJSON Pointer is just not powerful enough except for the simplest use cases. I very much prefer JSON Path.
- deleted 4y ago[deleted]
- avmich 4y agoLooks like in this proposal a less common escape technique is used. I wonder if we can adopt a standardized escaping method across various standards, languages and data structures, so one doesn't need to learn specifics every time.