Module json

Module json 

Source
Expand description

Compile-safe JSON serialization for large integers (u64/i64).

JavaScript’s Number.MAX_SAFE_INTEGER is 2^53 - 1. Values above this lose precision when parsed by JS clients. This module provides serde with helpers that stringify large values in JSON while keeping native integers in non-JSON formats (platform_value, bincode) via serializer.is_human_readable().

§Modules

  • safe_fieldsJsonSafeFields marker trait for compile-time enforcement
  • safe_integerserde(with) modules for bare u64/i64 and Option variants
  • safe_integer_mapserde(with) modules for BTreeMap fields containing u64

§Usage

These modules are used automatically by the #[json_safe_fields] attribute macro from dpp-json-convertible-derive. See that crate’s README for the full system.

Re-exports§

pub use safe_fields::JsonSafeFields;

Modules§

safe_fields
safe_integer
Serde with modules for bare u64/i64 fields and their Option variants.
safe_integer_map
Serde with modules for BTreeMap fields containing u64 keys and/or values.