jsonpointer

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package jsonpointer builds RFC 6901 JSON Pointer strings from mixed string and integer segments. Two separate packages (rules and validator) need this, and a circular-import-free home keeps the implementations from drifting.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(segments ...any) string

Build constructs a JSON Pointer from mixed string (object keys) and int (array indices) segments. Empty input yields "" (the root pointer per RFC 6901), not "/".

Examples:

Build("plugins", 2, "name") -> "/plugins/2/name"
Build("a/b")                 -> "/a~1b"
Build("a~b")                 -> "/a~0b"

func Escape

func Escape(s string) string

Escape implements RFC 6901 section 3 token escaping. Order matters: `~` must be escaped first, or the replacement `~1` from `/` → `~1` would itself get rewritten.

Types

This section is empty.

Jump to

Keyboard shortcuts

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