1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 00:22:41 +08:00
This commit is contained in:
2022-11-18 16:53:59 +08:00
parent 6e24cf5bdc
commit b76be4ce6b
17 changed files with 103 additions and 180 deletions

View File

@ -2,12 +2,13 @@ package json
import "github.com/charlienet/go-mixed/bytesconv"
// StructToJsonIndent 结构转换为带格式字符串
func StructToJsonIndent(obj any) string {
b, _ := MarshalIndent(obj, "", " ")
return bytesconv.BytesToString(b)
}
// 结构转换为json字符串
// StructToJson 结构转换为json字符串
func StructToJson(obj any) string {
b, _ := Marshal(obj)
return bytesconv.BytesToString(b)