{"id":8210135,"name":"github.com/flanksource/mapstructure","ecosystem":"go","description":"Package mapstructure exposes functionality to convert one arbitrary\nGo type into another, typically to convert a map[string]interface{}\ninto a native Go structure.\n\nThe Go structure can be arbitrarily complex, containing slices,\nother structs, etc. and the decoder will properly decode nested\nmaps and so on into the proper structures in the native Go struct.\nSee the examples to see what the decoder is capable of.\n\nThe simplest function to start with is Decode.\n\nWhen decoding to a struct, mapstructure will use the field name by\ndefault to perform the mapping. For example, if a struct has a field\n\"Username\" then mapstructure will look for a key in the source value\nof \"username\" (case insensitive).\n\nYou can change the behavior of mapstructure by using struct tags.\nThe default struct tag that mapstructure looks for is \"mapstructure\"\nbut you can customize it using DecoderConfig.\n\nTo rename the key that mapstructure looks for, use the \"mapstructure\"\ntag and set a value directly. For example, to change the \"username\" example\nabove to \"user\":\n\nEmbedded structs are treated as if they're another field with that name.\nBy default, the two structs below are equivalent when decoding with\nmapstructure:\n\nThis would require an input that looks like below:\n\nIf your \"person\" value is NOT nested, then you can append \",squash\" to\nyour tag value and mapstructure will treat it as if the embedded struct\nwere part of the struct directly. Example:\n\nNow the following input would be accepted:\n\nWhen decoding from a struct to a map, the squash tag squashes the struct\nfields into a single map. Using the example structs from above:\n\nWill be decoded into a map:\n\nDecoderConfig has a field that changes the behavior of mapstructure\nto always squash embedded structs.\n\nIf there are any unmapped keys in the source value, mapstructure by\ndefault will silently ignore them. You can error by setting ErrorUnused\nin DecoderConfig. If you're using Metadata you can also maintain a slice\nof the unused keys.\n\nYou can also use the \",remain\" suffix on your tag to collect all unused\nvalues in a map. The field with this tag MUST be a map type and should\nprobably be a \"map[string]interface{}\" or \"map[interface{}]interface{}\".\nSee example below:\n\nGiven the input below, Other would be populated with the other\nvalues that weren't used (everything but \"name\"):\n\nWhen decoding from a struct to any other value, you may use the\n\",omitempty\" suffix on your tag to omit that value if it equates to\nthe zero value. The zero value of all types is specified in the Go\nspecification.\n\nFor example, the zero type of a numeric type is zero (\"0\"). If the struct\nfield value is zero and a numeric type, the field is empty, and it won't\nbe encoded into the destination type.\n\nSince unexported (private) struct fields cannot be set outside the package\nwhere they are defined, the decoder will simply skip them.\n\nFor this output type definition:\n\nUsing this map as input:\n\nThe following struct will be decoded:\n\nmapstructure is highly configurable. See the DecoderConfig struct\nfor other features and options that are supported.","homepage":"https://github.com/flanksource/mapstructure","licenses":"MIT","normalized_licenses":["MIT"],"repository_url":"https://github.com/flanksource/mapstructure","keywords_array":[],"namespace":"github.com/flanksource","versions_count":1,"first_release_published_at":"2023-07-24T06:49:40.000Z","latest_release_published_at":"2023-07-24T06:49:40.000Z","latest_release_number":"v1.6.0","last_synced_at":"2026-04-08T04:16:47.308Z","created_at":"2023-09-05T03:05:13.702Z","updated_at":"2026-04-08T04:16:47.309Z","registry_url":"https://pkg.go.dev/github.com/flanksource/mapstructure","install_command":"go get github.com/flanksource/mapstructure","documentation_url":"https://pkg.go.dev/github.com/flanksource/mapstructure#section-documentation","metadata":{},"repo_metadata":{"uuid":"669156527","full_name":"flanksource/mapstructure","owner":"flanksource","description":"Go library for decoding generic map values into native Go structures and vice versa.","archived":false,"fork":true,"pushed_at":"2023-07-24T06:53:06.000Z","size":374,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2023-07-24T08:07:16.854Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"mitchellh/mapstructure","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flanksource.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-21T13:32:40.000Z","updated_at":"2023-07-21T13:34:15.000Z","dependencies_parsed_at":"2023-07-21T15:50:54.221Z","dependency_job_id":null,"html_url":"https://github.com/flanksource/mapstructure","commit_stats":null,"previous_names":["flanksource/mapstructure"],"tags_count":0,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flanksource%2Fmapstructure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flanksource%2Fmapstructure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flanksource%2Fmapstructure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flanksource%2Fmapstructure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flanksource","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":156936451,"owners_count":7658874,"icon_url":"https://github.com/github.png","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"}},"repo_metadata_updated_at":"2023-09-05T03:05:14.286Z","dependent_packages_count":12,"downloads":null,"downloads_period":null,"dependent_repos_count":1,"rankings":{"downloads":null,"dependent_repos_count":4.7581353553507055,"dependent_packages_count":2.2439748392112517,"stargazers_count":25.20824288440374,"forks_count":18.72762335551225,"docker_downloads_count":null,"average":12.734494108619486},"purl":"pkg:golang/github.com/flanksource/mapstructure","advisories":[],"docker_usage_url":"https://docker.ecosyste.ms/usage/go/github.com/flanksource/mapstructure","docker_dependents_count":1,"docker_downloads_count":12,"usage_url":"https://repos.ecosyste.ms/usage/go/github.com/flanksource/mapstructure","dependent_repositories_url":"https://repos.ecosyste.ms/api/v1/usage/go/github.com/flanksource/mapstructure/dependencies","status":null,"funding_links":[],"critical":null,"issue_metadata":null,"versions_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fflanksource%2Fmapstructure/versions","version_numbers_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fflanksource%2Fmapstructure/version_numbers","dependent_packages_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fflanksource%2Fmapstructure/dependent_packages","related_packages_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fflanksource%2Fmapstructure/related_packages","codemeta_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fflanksource%2Fmapstructure/codemeta","maintainers":[]}