Skip to content
JSON

JSON Pointer (RFC 6901)

Address a specific value by path.

By EZ4Code Team
pointerrfc6901

Code

// Document:
{ "foo": ["bar", "baz"], "": 0, "a/b": 1 }

// Pointers and resolved values:
""        -> the whole document
"/foo"    -> ["bar", "baz"]
"/foo/0"  -> "bar"
"/a~1b"   -> 1        (~1 escapes "/")
"/"       -> 0        (empty string key)

Explanation

JSON Pointer (RFC 6901) identifies a single value in a JSON document using a slash-separated path starting from the root. The escape sequences ~1 and ~0 represent a literal slash and tilde respectively. Pointers are reused by JSON Patch and JSON Schema for $ref locations.

More JSON Snippets