json

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const FALSE = 57347
View Source
const NULL = 57348
View Source
const NUMBER = 57349
View Source
const OPERATOR = 57353
View Source
const PLACEHOLDER = 57350
View Source
const STRING = 57352
View Source
const SUB_PARSER = 57351
View Source
const TRUE = 57346

Variables

This section is empty.

Functions

func AppendMarshal

func AppendMarshal(buf *bytes.Buffer, v any, indent int) error

AppendMarshal does the same as Marshal but appends the JSON encoding to buf.

func Marshal

func Marshal(v any, indent int) ([]byte, error)

Marshal returns the JSON encoding of v. It differs from encoding/json.Marshal as it only handles map[string]any, []any, bool, float64, string, nil and encoding/json.Marshaler values. It also accepts "invalid" JSON data returned by MarshalJSON method.

func Parse

func Parse(buf []byte, opts ...ParseOpts) (any, error)

Types

type Error

type Error struct {
	Pos Position
	// contains filtered or unexported fields
}

func (*Error) Error

func (e *Error) Error() string

type Operator

type Operator struct {
	Name   string
	Params []any
}

type ParseOpts

type ParseOpts struct {
	Placeholders       []any
	PlaceholdersByName map[string]any
	OpFn               func(Operator, Position) (any, error)
}

type Placeholder

type Placeholder struct {
	Num  int
	Name string
}

type Position

type Position struct {
	Pos  int
	Line int
	Col  int
	// contains filtered or unexported fields
}

func (Position) String

func (p Position) String() string

Jump to

Keyboard shortcuts

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