Documentation ¶
Overview ¶
Package jsonpointer implements representations for JSON Pointer and tokens.
Index ¶
- func Get(obj interface{}, pointer string) (interface{}, error)
- func UnescapeTokenString(token string) string
- type JSONPointer
- func (p *JSONPointer) Append(token Token) *JSONPointer
- func (p *JSONPointer) AppendString(token string) *JSONPointer
- func (p JSONPointer) Clone() JSONPointer
- func (p JSONPointer) DotNotation(bracketIndex bool) string
- func (p JSONPointer) EscapedStrings() []string
- func (p JSONPointer) Get(obj interface{}) (value interface{}, err error)
- func (p *JSONPointer) Len() int
- func (p *JSONPointer) Pop() Token
- func (p JSONPointer) String() string
- func (p JSONPointer) Strings() []string
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UnescapeTokenString ¶
UnescapeTokenString returns unescaped representation of the token.
Types ¶
type JSONPointer ¶
type JSONPointer []Token
JSONPointer is a sequence of Token.
func New ¶
func New(pointer string) (JSONPointer, error)
New parses a pointer string and creates a new JSONPointer.
func (*JSONPointer) Append ¶
func (p *JSONPointer) Append(token Token) *JSONPointer
Append appends the token.
func (*JSONPointer) AppendString ¶
func (p *JSONPointer) AppendString(token string) *JSONPointer
AppendString appends the token.
func (JSONPointer) Clone ¶
func (p JSONPointer) Clone() JSONPointer
Clone returns a duplicate of the JSONPointer.
func (JSONPointer) DotNotation ¶
func (p JSONPointer) DotNotation(bracketIndex bool) string
DotNotation returns dot-notated representation.
func (JSONPointer) EscapedStrings ¶
func (p JSONPointer) EscapedStrings() []string
EscapedStrings returns an array of each token string that is escaped.
func (JSONPointer) Get ¶
func (p JSONPointer) Get(obj interface{}) (value interface{}, err error)
Get retrieves a value from the obj.
func (JSONPointer) String ¶
func (p JSONPointer) String() string
String returns JSON Pointer representation.
func (JSONPointer) Strings ¶
func (p JSONPointer) Strings() []string
Strings returns an array of each token string.
type Token ¶
type Token string
Token is each part of a JSON Pointer.
func NewTokenFromEscaped ¶
NewTokenFromEscaped returns a new Token from an escaped string.
func (Token) EscapedString ¶
EscapedString returns escaped representation of the token.