jsonpointer

package
v1.0.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidPointer = errors.New("invalid JSON pointer")

Functions

func Resolve

func Resolve(base any, pointer Pointer) (any, error)

Resolve resolves the given JSON pointer against the given base object. The base object must be a pointer to a struct or a pointer to a slice/array. The returned value is a pointer to the pointed field.

Types

type Pointer

type Pointer []string

Pointer is a JSON Pointer as defined in RFC 6901.

func New

func New(elements ...string) Pointer

func Parse

func Parse(s string) (Pointer, error)

Parse returns a new pointer from the given string representation.

func (Pointer) Append

func (p Pointer) Append(tokens ...string) Pointer

Append appends the given tokens to the pointer.

func (Pointer) JSONSchemaAlias

func (p Pointer) JSONSchemaAlias() any

func (Pointer) MarshalJSON

func (p Pointer) MarshalJSON() ([]byte, error)

func (Pointer) String

func (p Pointer) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL