JSON Pointer defines a string syntax for identifying a specific value within a JavaScript Object Notation (JSON) document.
A JSON Pointer is a Unicode string (see RFC4627, Section 3) containing a sequence of
zero or more reference tokens, each prefixed by a / (%x2F) character.
Source: RFC6901
The example below return the first element of the array foo contained
within the (unmarshalled) JSON document.
var jsonDocument map[string]interface{}
_ = json.Unmarshal([]byte(JSON), &jsonDocument)
jsonPtr, _ := ptr.New("/foo/0")
value, err := jsonPtr.Get(jsonDocument)json-pointer = *( "/" reference-token )
reference-token = *( unescaped / escaped )
unescaped = %x00-2E / %x30-7D / %x7F-10FFFF
escaped = "~" ( "0" / "1" )
array-index = %x30 / ( %x31-39 *(%x30-39) )