Skip to content
This repository has been archived by the owner on Jun 6, 2022. It is now read-only.
/ flatten Public archive
forked from jeremywohl/flatten

Flatten nested maps to one-dimensional maps.

License

Notifications You must be signed in to change notification settings

peterupton/flatten

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Flatten nested maps to one-dimensional maps.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%