Skip to content

About

JavaScript Object Notation (JSON) Pointer

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript Object Notation (JSON) Pointer

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

Usage

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)

ABNF Representation

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) )

About

JavaScript Object Notation (JSON) Pointer

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages

⌂ 换网址