https://github.com/mitchellh/mapstructure
Score: 38.05458624089937
Last synced: about 19 hours ago
JSON representation
Repository metadata:
Go library for decoding generic map values into native Go structures and vice versa.
- Host: GitHub
- URL: https://github.com/mitchellh/mapstructure
- Owner: mitchellh
- License: mit
- Archived: true
- Created: 2013-05-20T05:24:34.000Z (over 12 years ago)
- Default Branch: main
- Last Pushed: 2024-06-25T15:17:23.000Z (about 1 year ago)
- Last Synced: 2025-09-01T04:55:00.294Z (5 days ago)
- Language: Go
- Homepage: https://gist.github.com/mitchellh/90029601268e59a29e64e55bab1c5bdc
- Size: 357 KB
- Stars: 8,020
- Watchers: 65
- Forks: 711
- Open Issues: 82
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Owner metadata:
- Name: Mitchell Hashimoto
- Login: mitchellh
- Email:
- Kind: user
- Description:
- Website: https://mitchellh.com
- Location: Los Angeles, CA
- Twitter: mitchellh
- Company:
- Icon url: https://avatars.githubusercontent.com/u/1299?u=cc88a733b0c95bdfd323ec661c0da4c6768c4e4b&v=4
- Repositories: 113
- Last Synced at: 2025-08-31T20:46:31.468Z
- Profile URL: https://github.com/mitchellh
GitHub Events
Total
- Fork event: 28
- Pull request event: 1
- Watch event: 166
- Total: 195
Last Year
- Fork event: 28
- Pull request event: 1
- Watch event: 166
- Total: 195
Committers metadata
Last synced: 29 days ago
Total Commits: 236
Total Committers: 66
Avg Commits per committer: 3.576
Development Distribution Score (DDS): 0.36
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
Name | Commits | |
---|---|---|
Mitchell Hashimoto | m****o@g****m | 151 |
Calvin Leung Huang | c****0@g****m | 4 |
Sebastian Widmer | s****r@t****h | 3 |
Ryan Uber | r****u@r****m | 3 |
Buğra Özgürsoy | b****r@g****m | 2 |
felipe.ramos | f****s@c****m | 2 |
Vladimir Skipor | s****r@y****u | 2 |
Shunsuke Suzuki | s****9@g****m | 2 |
Matt Keeler | m****7@g****m | 2 |
Mark Costello | m****k@m****t | 2 |
James Nugent | j****s@j****m | 2 |
Gernot Eger | g****r@g****m | 2 |
Daniel Nephin | d****n@g****m | 2 |
Aleksander Kochetkov | s****4@g****m | 2 |
Akos Gyimesi | g****s@g****m | 2 |
kevin.lin | k****n@s****m | 2 |
Zhao Jiangkun | j****o@e****e | 2 |
Andrew M Bursavich | a****h@g****m | 1 |
Adam Bouqdib | a****m@a****k | 1 |
Radek Simko | r****o@g****m | 1 |
Roman Leventov | l****u@g****m | 1 |
Roman Volosatovs | r****s@r****t | 1 |
RussellLuo | l****e@g****m | 1 |
Pierre Rossi | p****i@h****m | 1 |
Gerrit Renker | g****t@e****k | 1 |
noi | n****i@u****o | 1 |
lazada_hector_j | h****s@l****m | 1 |
hori-ryota | h****a@c****p | 1 |
dshilin | s****r@g****m | 1 |
Will Hughes | w****h@u****m | 1 |
and 36 more... |
Issue and Pull Request metadata
Last synced: 5 days ago
Total issues: 79
Total pull requests: 51
Average time to close issues: 5 months
Average time to close pull requests: 11 months
Total issue authors: 73
Total pull request authors: 45
Average comments per issue: 2.11
Average comments per pull request: 1.61
Merged pull request: 12
Bot issues: 0
Bot pull requests: 0
Past year issues: 0
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 0
Past year average comments per issue: 0
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- andig (3)
- mullerch (2)
- leventov (2)
- ghost (2)
- prochac (2)
- Chinwendu20 (1)
- albertleng (1)
- ubiuser (1)
- ganxiangdong (1)
- bep (1)
- vincentbernat (1)
- kaysonwu (1)
- DonDebonair (1)
- jnvillar (1)
- avoidik (1)
Top Pull Request Authors
- noamtamim (2)
- cuiweixie (2)
- mullerch (2)
- mitchellh (2)
- sagikazarmark (2)
- adriansmares (2)
- mthjs (2)
- triarius (2)
- m1k1o (2)
- caohao-go (2)
- ik9999 (1)
- ozgursoy (1)
- zenovich (1)
- vlanse (1)
- radeksimko (1)
Top Issue Labels
- bug (3)
- enhancement (1)
Top Pull Request Labels
Package metadata
- Total packages: 4
- Total downloads: unknown
- Total docker downloads: 62,915,760,717
- Total dependent packages: 32,864 (may contain duplicates)
- Total dependent repositories: 124,571 (may contain duplicates)
- Total versions: 68
proxy.golang.org: github.com/mitchellh/mapstructure
Package mapstructure exposes functionality to convert one arbitrary Go type into another, typically to convert a map[string]interface{} into a native Go structure. The Go structure can be arbitrarily complex, containing slices, other structs, etc. and the decoder will properly decode nested maps and so on into the proper structures in the native Go struct. See the examples to see what the decoder is capable of. The simplest function to start with is Decode. When decoding to a struct, mapstructure will use the field name by default to perform the mapping. For example, if a struct has a field "Username" then mapstructure will look for a key in the source value of "username" (case insensitive). You can change the behavior of mapstructure by using struct tags. The default struct tag that mapstructure looks for is "mapstructure" but you can customize it using DecoderConfig. To rename the key that mapstructure looks for, use the "mapstructure" tag and set a value directly. For example, to change the "username" example above to "user": Embedded structs are treated as if they're another field with that name. By default, the two structs below are equivalent when decoding with mapstructure: This would require an input that looks like below: If your "person" value is NOT nested, then you can append ",squash" to your tag value and mapstructure will treat it as if the embedded struct were part of the struct directly. Example: Now the following input would be accepted: When decoding from a struct to a map, the squash tag squashes the struct fields into a single map. Using the example structs from above: Will be decoded into a map: DecoderConfig has a field that changes the behavior of mapstructure to always squash embedded structs. If there are any unmapped keys in the source value, mapstructure by default will silently ignore them. You can error by setting ErrorUnused in DecoderConfig. If you're using Metadata you can also maintain a slice of the unused keys. You can also use the ",remain" suffix on your tag to collect all unused values in a map. The field with this tag MUST be a map type and should probably be a "map[string]interface{}" or "map[interface{}]interface{}". See example below: Given the input below, Other would be populated with the other values that weren't used (everything but "name"): When decoding from a struct to any other value, you may use the ",omitempty" suffix on your tag to omit that value if it equates to the zero value. The zero value of all types is specified in the Go specification. For example, the zero type of a numeric type is zero ("0"). If the struct field value is zero and a numeric type, the field is empty, and it won't be encoded into the destination type. Since unexported (private) struct fields cannot be set outside the package where they are defined, the decoder will simply skip them. For this output type definition: Using this map as input: The following struct will be decoded: mapstructure is highly configurable. See the DecoderConfig struct for other features and options that are supported.
- Homepage: https://github.com/mitchellh/mapstructure
- Documentation: https://pkg.go.dev/github.com/mitchellh/mapstructure#section-documentation
- Licenses: MIT
- Latest release: v1.5.0 (published over 3 years ago)
- Last Synced: 2025-09-04T06:02:29.231Z (2 days ago)
- Versions: 17
- Dependent Packages: 32,864
- Dependent Repositories: 124,571
- Docker Downloads: 62,915,760,717
-
Rankings:
- Docker downloads count: 0.002%
- Dependent packages count: 0.003%
- Dependent repos count: 0.006%
- Average: 0.39%
- Stargazers count: 0.803%
- Forks count: 1.135%
proxy.golang.org: github.com/Mitchellh/mapstructure
- Homepage:
- Documentation: https://pkg.go.dev/github.com/Mitchellh/mapstructure#section-documentation
- Licenses: mit
- Latest release: v1.5.0 (published over 3 years ago)
- Last Synced: 2025-09-04T06:02:31.897Z (2 days ago)
- Versions: 17
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Stargazers count: 0.77%
- Forks count: 1.113%
- Average: 5.509%
- Dependent packages count: 9.411%
- Dependent repos count: 10.74%
proxy.golang.org: github.com/MitchelLH/mapstructure
- Homepage:
- Documentation: https://pkg.go.dev/github.com/MitchelLH/mapstructure#section-documentation
- Licenses: mit
- Latest release: v1.5.0 (published over 3 years ago)
- Last Synced: 2025-09-04T06:02:48.640Z (2 days ago)
- Versions: 17
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 5.464%
- Average: 5.647%
- Dependent repos count: 5.83%
proxy.golang.org: github.com/mitchellh/mapStructure
- Homepage:
- Documentation: https://pkg.go.dev/github.com/mitchellh/mapStructure#section-documentation
- Licenses: mit
- Latest release: v1.5.0 (published over 3 years ago)
- Last Synced: 2025-09-04T06:02:46.995Z (2 days ago)
- Versions: 17
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 6.976%
- Average: 7.422%
- Dependent repos count: 7.868%
Dependencies
- actions/checkout v2 composite
- actions/setup-go v2 composite