This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Go implementation of JSON Pointer (RFC 6901) for navigating
and mutating JSON documents represented as Go values. Unlike most implementations, it works not only with
map[string]any and slices, but also with Go structs (resolved via json struct tags and reflection).
See docs/MAINTAINERS.md for CI/CD, release process, and repo structure details.
| File | Contents |
|---|---|
pointer.go |
Core types (Pointer, JSONPointable, JSONSetable), New, Get, Set, Offset, Escape/Unescape |
errors.go |
Sentinel errors: ErrPointer, ErrInvalidStart, ErrUnsupportedValueType |
New(string) (Pointer, error)— parse a JSON pointer string (e.g."/foo/0/bar")Pointer.Get(document any) (any, reflect.Kind, error)— retrieve a valuePointer.Set(document, value any) (any, error)— set a value (document must be pointer/map/slice)Pointer.Offset(jsonString string) (int64, error)— byte offset of token in raw JSONGetForToken/SetForToken— single-level convenience helpersEscape/Unescape— RFC 6901 token escaping (~0↔~,~1↔/)
Custom types can implement JSONPointable (for Get) or JSONSetable (for Set) to bypass reflection.
github.com/go-openapi/swag/jsonname— struct tag → JSON field name resolutiongithub.com/go-openapi/testify/v2— test-only assertions
See also .claude/plans/ROADMAP.md.
- Struct fields must have a
jsontag to be reachable; untagged fields are ignored (differs fromencoding/jsonwhich defaults to the Go field name). - Anonymous embedded struct fields are traversed only if tagged.
- The RFC 6901
"-"array suffix (append) is not implemented.