Home

Awesome

go-convmap

Build Status PkgGoDev Test Coverage Go Report Card GitHub last commit License

Go library to convert map[interface{}]interface{} to map[string]interface{}.

Background

https://github.com/go-yaml/yaml/issues/139

When we unmarshal YAML to interface{}, the data type of the map will be not map[string]interface{} but map[interface{}]interface{} even if the type of all keys is string. YAML accepts map key whose type isn't string, but JSON doesn't accept map key except for string. And not only JSON but also some languages like Tengo allow only string as map key.

So this library provides the feature to convert map[interface{}]interface{} to map[string]interface{}.

LICENSE

MIT