1
0
mirror of https://github.com/go-kratos/kratos.git synced 2026-05-16 09:48:28 +02:00

Fix: marshalJson error, when values contains map[interface{}]interface{} (#883)

Co-authored-by: tzz <tzz.wannamoney@qq.com>
This commit is contained in:
Tzz
2021-04-29 14:57:13 +08:00
committed by GitHub
parent 6919f158cd
commit 18ea3a6a47
+3 -3
View File
@@ -74,7 +74,7 @@ func (r *reader) Value(path string) (Value, bool) {
}
func (r *reader) Source() ([]byte, error) {
return marshalJSON(r.values)
return marshalJSON(convertMap(r.values))
}
func cloneMap(src map[string]interface{}) (map[string]interface{}, error) {
@@ -103,8 +103,8 @@ func convertMap(src interface{}) interface{} {
dst[fmt.Sprint(k)] = convertMap(v)
}
return dst
case []interface{} :
dst := make([]interface{},len(m))
case []interface{}:
dst := make([]interface{}, len(m))
for k, v := range m {
dst[k] = convertMap(v)
}