rawjson

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package rawjson validates JSON and edits selected object fields without serializing the surrounding message. Values are immutable and retain numbers as lexemes. Object comparison ignores key order; output never does.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal(a, b Value) bool

Equal compares all fields and array positions. String escape spelling is not significant; number spelling and type are (1, 1.0, true and "1" differ).

Types

type Kind

type Kind byte
const (
	Invalid Kind = iota
	Object
	Array
	String
	Number
	Boolean
	Null
)

type Value

type Value struct {
	// contains filtered or unexported fields
}

Value owns its source bytes. The zero value is invalid, distinct from null.

func Parse

func Parse(data []byte) (Value, error)

Parse rejects malformed JSON, invalid Unicode and duplicate decoded member names at every depth. It never converts a JSON number to a floating point value.

func (Value) Bool

func (v Value) Bool() (bool, error)

func (Value) Elements

func (v Value) Elements() []Value

func (Value) Int64

func (v Value) Int64() (int64, error)

func (Value) Keys

func (v Value) Keys() []string

func (Value) Kind

func (v Value) Kind() Kind

func (Value) Member

func (v Value) Member(key string) (Value, bool)

func (Value) Raw

func (v Value) Raw() []byte

func (Value) Replace

func (v Value) Replace(path []string, replacement Value) (Value, error)

Replace changes exactly one existing object member path. It neither adds a member nor matches other fields with the same name. The original is unchanged.

func (Value) String

func (v Value) String() (string, error)

Jump to

Keyboard shortcuts

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