-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unmarshal to map #150
Comments
It should be able to marshal/unmarshal a map of [Edit] Never mind - you must mean at the top level. That shouldn't be too difficult. I'll try to take a look at it the next couple of days. |
I just try to execute this code:
and I become an error |
A top-level of |
@BoGeM would the |
Yes that would make sense. Marking it as a future improvement. |
Better late than never! Since #341 got merged, the following test passes: tomlData := `
[a]
b = 1
[c]
d = "e"
`
expected := map[string]map[string]interface{}{
"a": map[string]interface{}{
"b": int64(1),
},
"c": map[string]interface{}{
"d": "e",
},
}
var v map[string]map[string]interface{}
if err := Unmarshal([]byte(tomlData), &v); err != nil {
panic(err)
}
if !reflect.DeepEqual(expected, v) {
t.Errorf("Bad unmarshal: expected %v, got %v", expected, v)
} I it closes this issue. If the latest master version does not work for you feel free to reopen. |
It will be very useful for nicksnyder/go-i18n#66 to unmarshal TOML to maps, not only to structs.
The text was updated successfully, but these errors were encountered: