diff --git a/array.go b/array.go index 1d21b88..0d5f8a8 100644 --- a/array.go +++ b/array.go @@ -201,6 +201,22 @@ func (at *Array) Convert() ([]interface{}, error) { at.itemType = reflect.Interface at.convertResult = make([]interface{}, len(val)) copy(at.convertResult, val) + case []struct{}: + at.isSimpleSlice = false + at.itemType = reflect.Interface + at.convertResult = make([]interface{}, len(val)) + for i := 0; i < len(val); i++ { + at.convertResult[i] = val[i] + } + case []map[string]interface{}: + at.isSimpleSlice = false + at.itemType = reflect.Interface + at.convertResult = make([]interface{}, len(val)) + for i := 0; i < len(val); i++ { + at.convertResult[i] = val[i] + } + default: + } return at.convertResult, nil } @@ -267,3 +283,16 @@ func (at *Array) Has(input interface{}) int { } return -1 } + +// ToString ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 16:57 2023/9/28 +func (at *Array) ToString() string { + if at.IsNil() { + return "" + } + byteData, _ := json.Marshal(at.convertResult) + return string(byteData) +}