json

package
v4.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package json implements encoding and decoding of JSON as defined in RFC 7159.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Marshal marshal v to string
	Marshal = json.Marshal
	// MarshalIndent marshal v to string with indent
	MarshalIndent = json.MarshalIndent
	// NewDecoder returns a new decoder that reads from r.
	//
	// The decoder introduces its own buffering and may
	// read data from r beyond the JSON values requested.
	NewDecoder = json.NewDecoder
)
View Source
var (
	// Unmarshal unmarshal json, do not support comment
	Unmarshal = json.Unmarshal
)

Functions

func MarshalToString

func MarshalToString(v interface{}) (string, error)

MarshalToString marshal v to string

func UnmarshalComment added in v4.6.0

func UnmarshalComment(raw []byte, v interface{}) (err error)

UnmarshalComment unmarshal json, support comment

Notice: this func will change the content of raw, all comments will be removed

func UnmarshalCommentFromString added in v4.6.0

func UnmarshalCommentFromString(str string, v interface{}) (err error)

UnmarshalCommentFromString unmarshal json from string, support comment

Notice: this func will change the content of raw, all comments will be removed

func UnmarshalFromString

func UnmarshalFromString(str string, v interface{}) (err error)

UnmarshalFromString unmarshal json from string, do not support comment

Types

This section is empty.

Jump to

Keyboard shortcuts

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