Help us shape the future of Go! Take the 2026 Go Developer Survey

jsonptr

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package jsonptr implements the subset of RFC 6901 JSON pointers Radar needs.

Index

Constants

This section is empty.

Variables

View Source
var ErrNonContainer = errors.New("JSON pointer crosses a non-container value")

ErrNonContainer reports a pointer that crosses a scalar value.

Functions

func Escape

func Escape(token string) string

Escape encodes one reference token.

func Lookup

func Lookup(doc any, ptr string) (value any, found bool, err error)

Lookup resolves ptr in a decoded JSON document. found is false when a member or index is absent; an error is returned for malformed pointers or when the pointer crosses a scalar.

func Tokens

func Tokens(ptr string) ([]string, error)

Tokens splits and unescapes a valid pointer.

func Unescape

func Unescape(token string) string

Unescape decodes one reference token.

func Validate

func Validate(ptr string) error

Validate checks pointer syntax: empty, or "/"-prefixed with valid ~ escapes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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