# msgspec/msgspec

A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML

Repository: https://github.com/msgspec/msgspec
Canonical: https://ross.abutalabs.com/products/msgspec
Homepage: https://msgspec.dev
Language: Python
License: BSD-3-Clause
License Family: permissive
Topics: msgpack, serialization, json, python, validation, deserialization, messagepack, json-schema, schema, serde, jsonschema, yaml, toml, openapi3
Last push: 2026-08-12T07:35:14+00:00

## Health v2 (maintenance only)
Score: 83/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 97, release rhythm 55, longevity 100
- inputs: {"age_days": 2045, "days_push": 21, "days_rel": 143, "gap_med": 135, "n_releases_24m": 4}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 4063, forks 180 (observed 2026-08-28T04:08:34.046226+00:00)

## What it is
msgspec is a fast Python serialization and validation library supporting JSON, MessagePack, YAML, and TOML. It combines high-performance encoders/decoders with zero-cost schema validation using Python type annotations and a speedy Struct type.

## Use cases
- fast json parsing in python
- validate api payloads with type annotations
- encode and decode msgpack messages
- replace dataclasses with faster structs
- generate json schema from python types
- parse toml config files
- deserialize yaml into typed objects

## When to choose
- you need the fastest JSON or MessagePack encoding/decoding in Python
- you want validation integrated into deserialization with no extra dependencies
- you need a lightweight alternative to pydantic for message schemas
- you're porting from orjson and want validation included

## When to avoid
- you need advanced validation features like pydantic's validators or custom constraints
- you're on Python < 3.10
- you need serialization formats beyond JSON, MessagePack, YAML, and TOML

## Facets
- artifact type: library
- maturity: stable
- function: serialization, form-handling, parser
- domain: developer-tools, apis, backend
- platform: python, cross-platform, wasm
- tags: json, msgpack, yaml, toml, json-schema, type-annotations, structs, high-performance, serde, data-engineering

## Member repositories
- msgspec/msgspec (main) score 83

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:34.046226+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-29T18:23:34.315374+00:00, confidence not recorded.
  - readme: https://github.com/msgspec/msgspec (fetched 2026-08-28T04:08:34.046226+00:00, sha 863751d0e271)
  - homepage: https://msgspec.dev (fetched 2026-08-29T09:15:50.929534+00:00, sha 588b4df46d75)
  - site_page: https://msgspec.dev/install.html (fetched 2026-08-29T09:15:50.939139+00:00, sha 674877366507)
  - site_page: https://msgspec.dev/api.html (fetched 2026-08-29T09:15:50.941588+00:00, sha bfacbe6085ed)
  - site_page: https://msgspec.dev/changelog.html (fetched 2026-08-29T09:15:50.945079+00:00, sha da192846d77e)
- Data as of 2026-08-30T08:39:29.467469+00:00.
