jsutil

package
v1.50.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(w io.Writer, v any) (err error)

Encode marshals the given interface and writes the json bytes to the given writer

func Marshal

func Marshal(v any) (data []byte, err error)

Marshal converts the given interface into json bytes

func NumberEqual

func NumberEqual(numberExp, numberGot Number) (eq bool)

NumberEqual is comparing the string representation of the json.Number. It fails to compare different formats, 1e10 != 10000000000, although it is the same mathematical value.

func Unmarshal

func Unmarshal(input []byte, output any) (err error)

Unmarshal decodes the input bytes into the output if it is valid cjson

func UnmarshalString

func UnmarshalString(input string, output any) (err error)

UnmarshalString is a wrapper for Unmarshal for string input

Types

type Array

type Array = []any

type Bool

type Bool = bool

type Number

type Number = json.Number

type Object

type Object = map[string]any

type RawMessage

type RawMessage = json.RawMessage

type String

type String = string

Jump to

Keyboard shortcuts

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