json

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = module.NewBuiltin().
	Func("decode(data bytes|string) (v any)											decodes JSON-encoded data and returns the resulting value", jsonDecode).
	Func("encode(v any) (data bytes)												returns the JSON encoding of v", jsonEncode).
	Func("indent(data bytes|string, prefix string, indent string) (result bytes)	returns an indented form of the JSON-encoded data", jsonIndent).
	Func("html_escape(data bytes|string) (result bytes)								returns the JSON-encoded data with &, <, and > characters escaped to \u0026, \u003c, and \u003e", jsonHTMLEscape)

Functions

func Decode

func Decode(data []byte) (ret vm.Object, err error)

Decode parses the JSON-encoded data and returns the result object.

func Encode

func Encode(o vm.Object) ([]byte, error)

Encode returns the JSON encoding of the object.

Types

type SyntaxError

type SyntaxError struct {
	Offset int64 // error occurred after reading Offset bytes
	// contains filtered or unexported fields
}

A SyntaxError is a description of a JSON syntax error.

func (*SyntaxError) Error

func (e *SyntaxError) Error() string

Jump to

Keyboard shortcuts

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