serde-tuplex
tuple serialization and lenient numeric parsing for serde
Features
- Lenient parsing: Numeric fields accept both numbers and strings (
123or"123") - Tuple format: Serialize structs as arrays (
[1, 2]instead of{"a": 1, "b": 2}) - Zero boilerplate: Just add
#[derive(Lenient)] - Field-level control: Use
#[serde_tuplex(skip)]orlenienthelper
Installation
Or manually in Cargo.toml:
[]
= "0.1"
= { = "1.0", = ["derive"] }
Usage
Lenient (struct format)
use Lenient;
TupleLenient (tuple format + lenient parsing)
use TupleLenient;
// Accepts: [1234567890, 23.5] or ["1234567890", "23.5"]
// Serializes to: [1234567890, 23.5]
Tuple (tuple format, strict parsing)
use Tuple;
// Serializes to: [10, 20]
With raw serde
use Deserialize;
Field-level control