Introduction
nim-json-serialization is a library in the nim-serialization family for turning Nim objects into JSON documents and back. Features include:
- Efficient coding of JSON documents directly to and from Nim data types
- Full type-based customization of both parsing and formatting
- Flavors for defining multiple JSON serialization styles per Nim type
- Efficient skipping of tags and values for partial JSON parsing
- Flexibility in mixing type-based and dynamic JSON access
- Structured
JsonValueRefnode type for DOM-style access to parsed document - Flat
JsonStringtype for passing nested JSON documents between abstraction layers - Seamless interoperability with
std/jsonandJsonNode
- Structured
- Full RFC8259 spec compliance including the notorious JSON number
- Passes JSONTestSuite
- Customizable parser strictness including support for non-standard extensions
- Well-defined handling of malformed / malicious inputs with configurable parsing limits
- Fuzzing and comprehensive manual test coverage
- Since v0.4.4, compile time encode/decode is supported. This means you can initialize a const value using decode. It is also ok to use it inside a static block or other Nim VM code.
Installation
As a nimble dependency:
requires "json_serialization"
Via nimble install:
nimble install json_serialization
API documentation
This guide covers basic usage of json_serialization - for details, see the
API reference.