simd-json-derive

Latest version documentation License

Derives for high performance JSON serialisation and deserialisation.

Usage

```rust

[derive(Serialize, Deserialize, Debug)]

[simdjson(denyunknownfields, renameall = "camelCase")]

struct MyStruct { firstfield: String, #[simdjson(rename = "foo")] second_field: Option }

fn main -> Result<(), simdjson::Error> { let mystruct = MyStruct { firstfield: "i am first".tostring(), secondfield: None } println!("Before: {mystruct:?}"); let mut jsonstring = mystruct.jsonstring()?; let deserialized = MyStruct::fromstr(jsonstring.asmut_str())?; println!("After: {deserialized:?}"); } ```

Supported Attributes

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

For fields:

For structs: