diff --git a/any.go b/any.go index 6d4a033..a74a343 100644 --- a/any.go +++ b/any.go @@ -110,7 +110,8 @@ func (at *AnyType) ToString() String { _ = serialize.JSON.Transition(at.data, &val) return String(ArrayType[any](val).ToString().Value) case consts.DataTypeMapAnyAny: - return String(EasyMap(at.data).ToString()) + easyMap := EasyMap(at.data) + return String(easyMap.ToString()) case consts.DataTypeInt: return String(Int(at.data.(int64)).ToString().Value) case consts.DataTypeUint: diff --git a/map.go b/map.go index 16ae07c..9ad1697 100644 --- a/map.go +++ b/map.go @@ -227,3 +227,13 @@ func (m *Map) MarshalJSON() ([]byte, error) { } return serialize.JSON.MarshalForByte(mapData) } + +// ToString 序列化成字符串 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 14:24 2024/11/21 +func (m *Map) ToString() string { + byteData, _ := m.MarshalJSON() + return string(byteData) +}