Documentation
¶
Overview ¶
Package jsonpath provides JSONPath query and extraction for Go. It supports type-safe extraction with generics, array indexing, wildcards, and setting values at paths. Zero external dependencies.
Index ¶
- func Delete(data []byte, path string) ([]byte, error)
- func Exists(data []byte, path string) (bool, error)
- func Get[T any](data []byte, path string) (T, error)
- func GetAll[T any](data []byte, path string) ([]T, error)
- func GetRaw(data []byte, path string) (any, error)
- func Set(data []byte, path string, value any) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get extracts a single value at the given JSONPath and unmarshals it to type T. Returns an error if the path is invalid, not found, or the value cannot be converted to T.
func GetAll ¶
GetAll extracts all matching values for a wildcard JSONPath and unmarshals each to type T. Use this with paths containing [*].
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.