jsonkit

package
v0.0.0-...-6ac1b1c Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(data string, v any) error

Decode 解码json内容

func Encode

func Encode(v any) string

Encode 将传入的参数编码为json字符串 由于此方法会忽略错误信息,使用时需要慎重

func Get

func Get(js, path string) interface{}

Get 从json字符串js中读取指定路径path(以/作为路径分割)的值 如果指定路径不存在,返回nil

func Marshal

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

Marshal 将给定的对象编码为(json字符串)字节数组

func MarshalIndent

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

MarshalIndent 带有缩进的Marshal

func MarshalSorted

func MarshalSorted(v interface{}) ([]byte, error)

MarshalSorted 将任意对象v进行json编码,并对key进行排序

func MarshalString

func MarshalString(v any) (string, error)

MarshalString 将Marshal得到的字节数组转换为字符串(json)并返回

func NumSafeDecode

func NumSafeDecode(jsonStr string, dst interface{}) error

NumSafeDecode 数字安全的 json 解码

func Unmarshal

func Unmarshal(data []byte, v any) error

Unmarshal 将给定的字节数组反序列化到目标对象v

func UnmarshalString

func UnmarshalString(data string, v any) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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