dpp/serialization/json/
mod.rs

1//! Compile-safe JSON serialization for large integers (u64/i64).
2//!
3//! JavaScript's `Number.MAX_SAFE_INTEGER` is `2^53 - 1`. Values above this lose
4//! precision when parsed by JS clients. This module provides serde `with` helpers
5//! that stringify large values in JSON while keeping native integers in non-JSON
6//! formats (platform_value, bincode) via `serializer.is_human_readable()`.
7//!
8//! ## Modules
9//!
10//! - [`safe_fields`] — `JsonSafeFields` marker trait for compile-time enforcement
11//! - [`safe_integer`] — `serde(with)` modules for bare u64/i64 and Option variants
12//! - [`safe_integer_map`] — `serde(with)` modules for BTreeMap fields containing u64
13//!
14//! ## Usage
15//!
16//! These modules are used automatically by the `#[json_safe_fields]` attribute macro
17//! from `dpp-json-convertible-derive`. See that crate's README for the full system.
18
19pub mod safe_fields;
20pub mod safe_integer;
21pub mod safe_integer_map;
22
23pub use safe_fields::JsonSafeFields;