Thanks to visit codestin.com
Credit goes to lib.rs

#json #core #core-json

no-std core-json-traits

Traits for working with JSON-serialized objects

7 releases

Uses new Rust 2024

0.4.1 Nov 9, 2025
0.4.0 Oct 21, 2025
0.2.1 Oct 9, 2025
0.1.2 Oct 5, 2025

#2317 in Parser implementations

MIT license

110KB
2K SLoC

core-json Traits

Traits for working with objects which may be deserialized from/serialized into JSON.

Internally, this uses the core-json crate for deserialization. That crate focuses on being minimal, only offering a dynamically-typed view as JSON-serialized data is processed. This crate additionally adds traits for deserializing into typed objects.

This crate also defines a trait and implementations for serializing into JSON. In order to maintain support for core, the serializers return impl Iterator<Item = char> (which may be transformed into a String by calling .collect::<String>() on the iterator).

For automatic derivation of JsonDeserialize and JsonSerialize, please see core-json-derive.

alloc Feature

The alloc feature enables implementations for Box, Vec, and String.

ryu Feature

The optional ryu features enables serializing f64s via ryu. When the ryu feature is not enabled, the implementation present in core is used, truncating to the first f64::DIGITS significant digits.

ryu is faster than core (https://github.com/rust-lang/rust/issues/52811) however, so it SHOULD be enabled for trees which already have ryu as a dependency. The ryu feature SHOULD NOT be enabled by libraries which depend on core-json-traits (solely the final consumer).

Changelog

A changelog may be found here.

Dependencies