About the JSON to Rust Struct
serde makes JSON easy in Rust once the structs exist. Paste a sample and this tool writes them: snake_case field names with #[serde(rename = "...")] when the JSON key differs, i64/f64/String/bool types, Vec<T> for arrays and nested structs for objects.
Reserved words like type become raw identifiers (r#type), so the code compiles.
How to use the JSON to Rust Struct
- Paste a JSON sample.
- Set the root struct name.
- Copy the Rust code.
Features
- serde derives
- Automatic renames
- Raw identifiers for keywords
- Nested structs
Supported formats
- Plain text
Frequently asked questions
What does Option<serde_json::Value> mean?
A null in the sample could be any type. Replace it with the real type once you know it.
Is my text sent anywhere?
No. Everything runs in your browser, so nothing you paste is uploaded or stored.
Added · Last reviewed · Maintained by Sohail Khax · How we test tools