8 releases (breaking)

0.18.0 Oct 7, 2025
0.16.1 Aug 4, 2025
0.16.0 Apr 1, 2025
0.15.0 Oct 24, 2024
0.1.9 Jul 10, 2020

#4 in #json-derive

Download history 291/week @ 2026-01-07 422/week @ 2026-01-14 408/week @ 2026-01-21 164/week @ 2026-01-28 230/week @ 2026-02-04 142/week @ 2026-02-11 192/week @ 2026-02-18 141/week @ 2026-02-25 362/week @ 2026-03-04 385/week @ 2026-03-11 450/week @ 2026-03-18 206/week @ 2026-03-25 319/week @ 2026-04-01 338/week @ 2026-04-08 193/week @ 2026-04-15 266/week @ 2026-04-22

1,140 downloads per month
Used in 10 crates (8 directly)

Apache-2.0/MIT

52KB
1.5K SLoC

simd-json-derive

Latest version documentation License

Derives for high performance JSON serialisation and deserialisation.

Usage


#[derive(Serialize, Deserialize, Debug)]
#[simd_json(deny_unknown_fields, rename_all = "camelCase")]
struct MyStruct {
    first_field: String,
    #[simd_json(rename = "foo")]
    second_field: Option<usize>
}

fn main -> Result<(), simd_json::Error> {
    let my_struct = MyStruct {
        first_field: "i am first".to_string(),
        second_field: None
    }
    println!("Before: {my_struct:?}");
    let mut json_string = my_struct.json_string()?;
    let deserialized = MyStruct::from_str(json_string.as_mut_str())?;
    println!("After: {deserialized:?}");
}

Supported Attributes

Attributes are supported for both #[simd_json(...)] and for compatibilty also for #[serde(...)] and follow the same naming conventions as serde.

For fields:

  • rename = "new_name" - renames a field

For structs:

  • rename_all = "camelCase" - renames all (not otherwise renamed) based on the rule, camelCase is currently supported
  • deny_unknown_fields - Errors if unknown fields are encountered

Dependencies

~3MB
~62K SLoC