Skip to content

stephenberry/JSON-Pointer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

JSON-Pointer

This document serves as an easy to read explanation of the JSON Pointer Specification.

JSON Pointer syntax allows the access of a specific element within a JSON document.


A path points to the desired element.

  • The path begins with /
  • Keys are separated by /
  • A key is either an object key or an array index

Given a JSON object:

{
   "colors": ["red", "green"],
   "": 0,
   "a/b": 1,
   "c%d": 2,
   "e^f": 3,
   "g|h": 4,
   "i\\j": 5,
   "k\"l": 6,
   " ": 7,
   "m~n": 8
}

Below are the JSON pointer paths to each element:

""           	// the whole document
"/colors"    	["red", "green"]
"/colors/0"  	"red"
"/"          	0
"/a~1b"      	1
"/c%d"       	2
"/e^f"       	3
"/g|h"       	4
"/i\\j"      	5
"/k\"l"      	6
"/ "         	7
"/m~0n"      	8

~ is delimited with ~0

/ is delimited with ~1

Nested Example

{
  "grandparent": {
    "parent": {
      "child": {
        "name": "bob"
      }
    }
  }
}

The path to "bob" is "/grandparent/parent/child/name".

About

JSON Pointer Specification

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published