A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML.
Actively maintained. Last release 2 months ago, commits in 20 of the last 26 weeks. A safe choice.
pip install msgspecmsgspec is a fast serialization and validation library, with builtin
support for JSON, MessagePack,
YAML, and TOML. It features:
-
🚀 High performance encoders/decoders for common protocols. The JSON and MessagePack implementations regularly benchmark as the fastest options for Python.
-
🎉 Support for a wide variety of Python types. Additional types may be supported through extensions.
-
🔍 Zero-cost schema validation using familiar Python type annotations. In benchmarks
msgspecdecodes and validates JSON faster than orjson can decode it alone. -
✨ A speedy Struct type for representing structured data. If you already use dataclasses or , should feel familiar. However, they're for common operations.