Fix ToMap conversion of array of tables (#83)

This commit is contained in:
Thomas Pelletier
2016-08-15 21:00:14 +02:00
committed by GitHub
parent de2e921d55
commit 06484b677b
2 changed files with 25 additions and 2 deletions
+3 -2
View File
@@ -126,10 +126,11 @@ func (t *TomlTree) ToMap() map[string]interface{} {
for k, v := range t.values {
switch node := v.(type) {
case []*TomlTree:
result[k] = make([]interface{}, 0)
array := make([]interface{}, 0)
for _, item := range node {
result[k] = item.ToMap()
array = append(array, item.ToMap())
}
result[k] = array
case *TomlTree:
result[k] = node.ToMap()
case map[string]interface{}: