Last active
March 25, 2023 07:14
-
-
Save geraintluff/5911303 to your computer and use it in GitHub Desktop.
Additional Relative JSON Pointer examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"test": ["foo", "bar"], | |
"child": { | |
"grandchild": 12345 | |
}, | |
"sibling": "sibling value", | |
"awkwardly/named~variable": true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Agree with u.
{"grandchild": 12345} "1" should be "<<the whole document >>"
{"grandchild": 12345} "2" should be "<<fails>>"
There is a typo in line 30, resul should read "awkwardly/named~variable"
.
how to use the Relative JSON Pointer in a schema actually? Do I need to use $data or $ref?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I am currently testing a new library with relative pointers support. The example
seems to be erroneous, it is also inconsistent with the example
because this implies "1" as the root of the whole document.
The valid entry should be
WKR
Arno-Can Uestuensoez