Skip to content
This repository has been archived by the owner on Jun 6, 2022. It is now read-only.

Latest commit

 

History

History
37 lines (26 loc) · 781 Bytes

README.md

File metadata and controls

37 lines (26 loc) · 781 Bytes

flatten

GoDoc Build Status

Flatten makes flat, one-dimensional maps from arbitrarily nested ones.

It turns map keys into compound names.

It takes input as Go structures.

nested := map[string]interface{}{
   "a": "b",
   "c": map[string]interface{}{
       "d": "e",
       "f": "g",
   },
   "z": 1.4567,
}

flat, err := flatten.Flatten(nested, ".")

// output:
// map[string]interface{}{
//  "a":    "b",
//  "c.d": "e",
//  "c.f": "g",
//  "z":    1.4567,
// }

See godoc for API.