Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Additional Relative JSON Pointer examples
{
"test": ["foo", "bar"],
"child": {
"grandchild": 12345
},
"sibling": "sibling value",
"awkwardly/named~variable": true
}
Starting value Relative JSON Pointer result
-------------------------------------------------------------------------
"bar" "0" "bar"
"bar" "0#" 1
"bar" "1" ["foo", "bar"]
"bar" "1/0" "foo"
"bar" "1/1" "bar"
"bar" "1#" "test"
"bar" "2" << the whole document >>
"bar" "2#" << fails >>
"bar" "3" << fails >>
12345 "0" 12345
12345 "0#" "grandchild"
12345 "1" {"grandchild": 12345}
12345 "1/grandchild" 12345
12345 "1#" "child"
12345 "2" << the whole document >>
12345 "2/sibling" "sibling value"
12345 "2/test/1" "bar"
{"grandchild": 12345} "0" {"grandchild": 12345}
{"grandchild": 12345} "0#" "child"
{"grandchild": 12345} "0/grandchild" 12345
{"grandchild": 12345} "1/sibling" "sibling value"
{"grandchild": 12345} "2" << the whole document >>
"sibling value" "0" "sibling value"
"sibling value" "0#" "sibling"
"sibling value" "1" << the whole document >>
"sibling value" "1/awkwardly~1named~0variable" true
true "0" true
true "0#" "awkwardly/named-variable"
@ArnoCan

This comment has been minimized.

Show comment
Hide comment
@ArnoCan

ArnoCan Apr 26, 2018

Hello,
I am currently testing a new library with relative pointers support. The example

{"grandchild": 12345} "2" << the whole document >>

seems to be erroneous, it is also inconsistent with the example

{"grandchild": 12345} "1/sibling" "sibling value

because this implies "1" as the root of the whole document.
The valid entry should be

{"grandchild": 12345} "1" << the whole document >>

WKR
Arno-Can Uestuensoez

ArnoCan commented Apr 26, 2018

Hello,
I am currently testing a new library with relative pointers support. The example

{"grandchild": 12345} "2" << the whole document >>

seems to be erroneous, it is also inconsistent with the example

{"grandchild": 12345} "1/sibling" "sibling value

because this implies "1" as the root of the whole document.
The valid entry should be

{"grandchild": 12345} "1" << the whole document >>

WKR
Arno-Can Uestuensoez

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment