jsonUtil

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Camel2Case

func Camel2Case(name string) string

驼峰式写法转为下划线写法

func CamelCase

func CamelCase(obj interface{}, ucfirst bool) map[string]interface{}

func Case2Camel

func Case2Camel(name string) string

下划线写法转为驼峰写法

func ContainsKey

func ContainsKey(obj map[string]interface{}, key string) bool

func GetData

func GetData(reader io.Reader) (map[string]interface{}, error)

func HasId

func HasId(obj map[string]interface{}) bool

func IsArray

func IsArray(obj interface{}) bool

func IsNumber

func IsNumber(obj interface{}) (float64, bool)

func IsString

func IsString(obj interface{}) bool

func Lcfirst

func Lcfirst(str string) string

首字母小写

func ParseCamelCase

func ParseCamelCase(bytes []byte, ucfirst bool) map[string]interface{}

func ParseData

func ParseData(jsonStr string) map[string]interface{}

func ParseLcCamelCase

func ParseLcCamelCase(bytes []byte) map[string]interface{}

func ParseSnakeCase

func ParseSnakeCase(bytes []byte) map[string]interface{}

func ParseUcCamelCase

func ParseUcCamelCase(bytes []byte) map[string]interface{}

func SnakeCase

func SnakeCase(obj interface{}) map[string]interface{}

func ToData

func ToData(jsonStr []byte) map[string]interface{}

func ToJson

func ToJson(data interface{}) string

func ToStruct

func ToStruct(m map[string]interface{}, result *interface{}) *interface{}

func Ucfirst

func Ucfirst(str string) string

首字母大写

Types

type Buffer

type Buffer struct {
	*bytes.Buffer
}

内嵌bytes.Buffer,支持连写

func NewBuffer

func NewBuffer() *Buffer

func (*Buffer) Append

func (b *Buffer) Append(i interface{}) *Buffer

type JsonCamelCaseLcfirst

type JsonCamelCaseLcfirst struct {
	Value interface{}
}

小驼峰json

func (JsonCamelCaseLcfirst) MarshalJSON

func (c JsonCamelCaseLcfirst) MarshalJSON() ([]byte, error)

type JsonCamelCaseUcfirst

type JsonCamelCaseUcfirst struct {
	Value interface{}
}

大驼峰json

func (JsonCamelCaseUcfirst) MarshalJSON

func (c JsonCamelCaseUcfirst) MarshalJSON() ([]byte, error)

type JsonSnakeCase

type JsonSnakeCase struct {
	Value interface{}
}

下划线json

func (JsonSnakeCase) MarshalJSON

func (c JsonSnakeCase) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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