fastjson icon indicating copy to clipboard operation
fastjson copied to clipboard

How to get a map from Value type

Open seanlook opened this issue 6 years ago • 2 comments

I can't find any API that convert Value to a map, just like gson does:

m, ok := gjson.Parse(json).Value().(map[string]interface{})

seanlook avatar Sep 03 '19 08:09 seanlook

There is no such API. Use Object.Visit for iterating over all the items in the object or Object.Get for obtaining value by key.

valyala avatar Sep 03 '19 13:09 valyala

Ok, I'll try it. Thanks.

seanlook avatar Sep 03 '19 14:09 seanlook