json

package
v0.0.0-...-4963dd4 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(key string, defaultValue string, body string) string

Get 从json中提取单个值

func GetArray

func GetArray(key string, body string) []string

GetArray 从json提取array

func Gets

func Gets(key string, defaultValue string, body string) string

Gets 从json中提取单个值,可以使用逗号分割多个key作为备选

Types

type JSONUtils

type JSONUtils struct {
	// contains filtered or unexported fields
}

JSONUtils a json utils object

func New

func New(message []byte, maxLevel int, skipSimpleArray bool) (*JSONUtils, error)

New create a new json utils object and parse json to object

func (*JSONUtils) ToKvPairs

func (ju *JSONUtils) ToKvPairs() map[string]string

ToKvPairs convert to a map with kv

func (*JSONUtils) ToKvPairsArray

func (ju *JSONUtils) ToKvPairsArray() []KvPair

ToKvPairsArray convert to an array with all kv pair

type KvPair

type KvPair struct {
	Key   string
	Value string
}

KvPair a kv pair

Jump to

Keyboard shortcuts

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