jsonpath

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package jsonpath provides utilities for working with JSONPath RFC-9535, which is primarily used in govy for constructing property names.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeSegment

func EscapeSegment(segment string) string

EscapeSegment accepts a path segment (not the entire path!) and escapes any special characters. Examples:

EscapeSegment("foo") --> "foo"
EscapeSegment("'foo'") --> "['\'foo\'']"
EscapeSegment("foo.bar") --> "['foo.bar']"

func Join

func Join(path, segment string) string

Join extends the JSONPath with a new segment. The segment can be a path in of itself, the segment is assumed to be escaped with EscapeSegment. Example:

Join("foo.bar", "baz") --> "foo.bar.baz"
Join("foo.bar", "baz.foo") --> "foo.bar.baz.foo"

func JoinArray

func JoinArray(path, segment string) string

JoinArray extends the JSONPath with a new array segment. Example:

JoinArray("foo.bar", "[2]") --> "foo.bar[2]"

func NewArrayIndex

func NewArrayIndex(index int) string

NewArrayIndex creates a new array index path segment for the given index. Example:

NewArrayIndex(2) --> "[2]"

Types

This section is empty.

Jump to

Keyboard shortcuts

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