jsonconv

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

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Camel = 0 //驼峰
	Case  = 1 //下划线
)

Variables

This section is empty.

Functions

func Camel2Case

func Camel2Case(XxYY string) string

*

  • 驼峰式写法转为下划线写法
  • @description XxYx->xx_yy XxYY->xx_yy EncodeURL->url TagDTOList->tag_dto_list *

func Case2Camel

func Case2Camel(xx_y_y string) string

*

  • 下划线转驼峰
  • @description xx_yy to XxYx xx_y_y to XxYY XxYY to XxYY
  • @date 2023/2/15
  • @param xx_y_y
  • @return XxYY *

func Case2CamelLowerStart

func Case2CamelLowerStart(xx_y_y string) string

*

  • 下划线转驼峰
  • @description xx_yy to XxYx xx_y_y to XxYY XxYY to XxYY
  • @date 2023/2/15
  • @param xx_y_y
  • @return xxYY *

func JsonToObject

func JsonToObject(jsonStr string, obj any) error

调用 JsonToObject(jsonStr , &obj)

func Lcfirst

func Lcfirst(str string) string

首字母小写

func ObjectToJson

func ObjectToJson(data any) string

默认json

func ObjectToJsonCamel

func ObjectToJsonCamel(data any) string

转首字母驼峰json

func ObjectToJsonIndent

func ObjectToJsonIndent(data any) string

转换行结构json

func ObjectToJsonSnake

func ObjectToJsonSnake(data any) string

转下划线json

func ObjectToJsonSnakeIdent

func ObjectToJsonSnakeIdent(data any) string

转下划线json

func SetCamelCaseJsonTag

func SetCamelCaseJsonTag(v interface{})

设置json tag为下划线,需要传入指针类型。该方法无效

func SprintPrivateValue

func SprintPrivateValue(data any) string

func Ucfirst

func Ucfirst(str string) string

首字母大写

func UnmarshalJSONIgnoreCase

func UnmarshalJSONIgnoreCase(data []byte, obj interface{}) error

json解析忽略大小写

Types

type JsonCamelCase

type JsonCamelCase struct {
	Value interface{}
}

************************************** 驼峰json **************************************

func (JsonCamelCase) MarshalJSON

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

转换为json,key全部变为下划线

type JsonSnakeCase

type JsonSnakeCase struct {
	Value interface{}
}

https://www.cnblogs.com/chenqionghe/p/13067596.html ************************************** 下划线json **************************************

func (JsonSnakeCase) MarshalJSON

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

转换为json,key全部变为驼峰

Jump to

Keyboard shortcuts

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