# mitchellh/mapstructure

Go library for decoding generic map values into native Go structures and vice versa.

Repository: https://github.com/mitchellh/mapstructure
Canonical: https://ross.abutalabs.com/products/mapstructure
Homepage: https://gist.github.com/mitchellh/90029601268e59a29e64e55bab1c5bdc
Language: Go
License: MIT
License Family: permissive
Archived: true
Last push: 2024-06-25T15:17:23+00:00

## Health v2 (maintenance only)
Score: 10/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 4853, "days_push": 799, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases, archived
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 8025, forks 732 (observed 2026-08-28T04:10:11.894138+00:00)

## What it is
mapstructure is a Go library for decoding generic map values (e.g. map[string]interface{}) into native Go structs and vice versa, with helpful error handling. It is commonly used to decode dynamic data from JSON, Gob, or configuration sources where the exact structure isn't known until runtime.

## Use cases
- decode json into go structs dynamically
- convert map[string]interface{} to struct in go
- decode configuration files into typed structs
- handle polymorphic json payloads based on a type field
- marshal go structs back into generic maps
- weakly typed field conversion when decoding data

## When to choose
- you need to decode dynamic or schema-less data into Go structs
- you must inspect part of a payload (like a type field) before choosing a target struct
- you want lenient decoding with custom hooks, tags, and error accumulation

## When to avoid
- you need active maintenance or new features - the repository is archived and no longer accepts issues or releases
- your data has a fixed, known schema - standard encoding/json unmarshaling is simpler
- you need high-performance serialization - reflection-based decoding adds overhead

## Facets
- artifact type: library
- maturity: abandoned
- function: serialization, parser, configuration-management
- domain: developer-tools, apis, backend
- platform: go, cross-platform
- tags: go-library, map-decoding, struct-decoding, archived

## Member repositories
- mitchellh/mapstructure (main) score 10

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:10:11.894138+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:31:49.349606+00:00, confidence not recorded.
  - readme: https://github.com/mitchellh/mapstructure (fetched 2026-08-28T04:10:11.894138+00:00, sha 0b5e51cb685c)
  - homepage: https://gist.github.com/mitchellh/90029601268e59a29e64e55bab1c5bdc (fetched 2026-08-29T08:29:15.595489+00:00, sha 45ba7fc863a7)
- Data as of 2026-08-30T08:39:29.467469+00:00.
