json

package
v0.2.88 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package json provides json operations wrapping ignoring stdlib or third-party lib json.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(v interface{}) (marshaledBytes []byte, err error)

Marshal adapts to json/encoding Marshal API.

Marshal returns the JSON encoding of v, adapts to json/encoding Marshal API Refer to https://godoc.org/encoding/json#Marshal for more information.

func MarshalIndent

func MarshalIndent(v interface{}, prefix, indent string) (marshaledBytes []byte, err error)

MarshalIndent same as json.MarshalIndent.

func NewDecoder

func NewDecoder(reader io.Reader) *json.Decoder

NewDecoder adapts to json/stream NewDecoder API.

NewDecoder returns a new decoder that reads from r.

Instead of a json/encoding Decoder, a Decoder is returned Refer to https://godoc.org/encoding/json#NewDecoder for more information.

func NewEncoder

func NewEncoder(writer io.Writer) *json.Encoder

NewEncoder same as json.NewEncoder

func Unmarshal

func Unmarshal(data []byte, v interface{}) (err error)

Unmarshal adapts to json/encoding Unmarshal API

Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v. Refer to https://godoc.org/encoding/json#Unmarshal for more information.

func UnmarshalUseNumber

func UnmarshalUseNumber(data []byte, v interface{}) (err error)

UnmarshalUseNumber decodes the json data bytes to target interface using number option.

func Valid

func Valid(data []byte) bool

Valid reports whether data is a valid JSON encoding.

Types

type RawMessage

type RawMessage = json.RawMessage

RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.

Jump to

Keyboard shortcuts

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