{"id":48994833,"url":"https://github.com/turtlemonvh/mapmap","last_synced_at":"2026-04-18T16:12:49.050Z","repository":{"id":57499459,"uuid":"50760194","full_name":"turtlemonvh/mapmap","owner":"turtlemonvh","description":"Apply map functions to map data structure in golang to do simple transformations on json-like data.","archived":false,"fork":false,"pushed_at":"2016-03-23T19:19:48.000Z","size":17,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-17T14:48:24.035Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/turtlemonvh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-31T05:23:33.000Z","updated_at":"2021-07-28T03:01:16.000Z","dependencies_parsed_at":"2022-08-31T11:01:03.282Z","dependency_job_id":null,"html_url":"https://github.com/turtlemonvh/mapmap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/turtlemonvh/mapmap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turtlemonvh%2Fmapmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turtlemonvh%2Fmapmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turtlemonvh%2Fmapmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turtlemonvh%2Fmapmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/turtlemonvh","download_url":"https://codeload.github.com/turtlemonvh/mapmap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turtlemonvh%2Fmapmap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31975073,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-18T16:12:47.363Z","updated_at":"2026-04-18T16:12:49.041Z","avatar_url":"https://github.com/turtlemonvh.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Mapmap [![GoDoc](https://godoc.org/github.com/turtlemonvh/mapmap?status.svg)](https://godoc.org/github.com/turtlemonvh/mapmap)\n===\n\n\u003e It maps your maps!\n\n\u003e **WARNING:** Development of this library has been suspended (3/22/2016) because other libraries seem to provide similar features in a better way. The `flatmap` package may still be useful for some projects.\n\n\u003e **WORK IN PROGRESS:** Very limited features so far.\n\n## Quick Start\n\nMapmap is for doing quick transformations on `map[string]interface{}` and `[]interface{}` objects in golang (the stuff you get back when parsing json).\n\nBasic usage for shuffling around fields is as follows:\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/turtlemonvh/mapmap\"\n)\n\nfunc main() {\n\n    // You need an object to map\n    m := map[string]interface{}{\n        \"cat\":        \"garfield\",\n        \"dog\":        \"odie\",\n        \"friends\":    []interface{}{\"John\"},\n        \"turtle\":     \"0\",\n        \"57\":         int64(57),\n        \"doesItWork\": true,\n    }\n\n    // Create a slice of `Mapper`s describing transformations to run\n    var mappers []*mapmap.Mapper\n    mappers = append(mappers, mapmap.NewMapper(\"cat\", \"cat\"))\n    mappers = append(mappers, mapmap.NewMapper(\"turtle\", \"frog\"))\n    mappers = append(mappers, mapmap.NewMapper(\"friends.[0]\", \"myOnlyFriend\"))\n\n    // Run the tranformations\n    new_map, processingErrors, err = mapmap.MapIt(m, mappers)\n\n    fmt.Println(new_map)\n}\n```\n\nThis would result in the following value for `new_map`:\n\n```go\nmap[string]interface{}{\n    \"cat\":          \"garfield\",\n    \"frog\":         \"0\",\n    \"myOnlyFriend\": \"John\",\n}\n```\n\n## Testing\n\n    go test ./...\n\n## Credits\n\n* Built with the awesome [`cast` library](https://github.com/spf13/cast) from spf13. \n* Inspired by the [`viper` library](https://github.com/spf13/cast) from spf13.\n* Lots of source taken from the [`flatmap` library](https://github.com/hashicorp/terraform/blob/master/flatmap/flatten.go) in terraform.\n    * Mostly I just manage maps with interfaces and return errors instead of panicing.\n\n## Alternatives\n\nThe following is a list of libraries that you may want to use instead of `mapmap`.\n\n* https://github.com/buger/jsonparser\n    * fast json parser\n    * allows accessing values by path\n* https://github.com/fatih/structs\n    * package for working with arbitrary `struct`s and transforming into `map[string]interface{}`\n* https://github.com/mitchellh/mapstructure\n    * package for converting between `struct`s and arbitrary `map`s\n    * good for json of unknown strucrure\n* https://github.com/Jeffail/gabs\n    * package for working with dynamic or unknown json\n    * allows accessing values by path\n* https://github.com/akutz/golf\n    * package for listing the fields of arbitrary data types\n* https://github.com/imdario/mergo\n    * package for merging go structs and maps\n* https://github.com/mitchellh/reflectwalk\n    * package for walking complex object structures\n\n\n## TODO\n\n* add transform functions\n* add validators\n* add type handling\n* add error handling (returning array of errors) in addition to standard handling\n* add benchmarks for simple transformations\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fturtlemonvh%2Fmapmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fturtlemonvh%2Fmapmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fturtlemonvh%2Fmapmap/lists"}