diff --git a/internal/encoding/javaproperties/map_utils.go b/internal/encoding/javaproperties/map_utils.go index 93755ca..01c4669 100644 --- a/internal/encoding/javaproperties/map_utils.go +++ b/internal/encoding/javaproperties/map_utils.go @@ -60,6 +60,8 @@ func flattenAndMergeMap(shadow map[string]interface{}, m map[string]interface{}, switch val.(type) { case map[string]interface{}: m2 = val.(map[string]interface{}) + case []interface{}: + m2 = cast.ToStringMap(val) case map[interface{}]interface{}: m2 = cast.ToStringMap(val) default: diff --git a/util.go b/util.go index ee7a86d..2453fee 100644 --- a/util.go +++ b/util.go @@ -190,12 +190,13 @@ func deepSearch(m map[string]interface{}, path []string) map[string]interface{} m = m3 continue } - m3, ok := m2.(map[string]interface{}) - if !ok { - // intermediate key is a value - // => replace with a new map + m3, isMap := m2.(map[string]interface{}) + if !isMap { + // in case the intermediate value is not a map + // a slice with previous value and a new map gets created m3 = make(map[string]interface{}) - m[k] = m3 + mixedValue := []interface{}{m2, m3} + m[k] = mixedValue } // continue search from here m = m3