JSON to Rust Serde
Generate Rust structs with Serde derives from JSON. Handles nesting, vectors, and renamed fields.
About JSON to Rust Serde
Paste JSON and get Rust structs annotated with #[derive(Serialize, Deserialize, Debug)]. Nested objects become their own structs, arrays become Vec<T>, and fields whose JSON key is not snake_case get a #[serde(rename = "...")] attribute. Ideal for modeling API responses with serde_json. Runs in your browser.
All processing happens entirely in your browser using modern web APIs. Nothing is uploaded to our servers — your data stays local and private. Free to use forever.
Common use cases
- Modeling a JSON API response as Rust structs for serde_json
- Avoiding manual serde rename attributes for camelCase APIs
- Generating typed data models from sample payloads
- Bootstrapping config structs from JSON
- Creating Rust test fixtures from JSON data
How it works
The JSON is parsed into a structural type tree. Each object becomes a struct deriving Serialize, Deserialize, and Debug. Field names are converted to snake_case; when that differs from the original JSON key, a #[serde(rename = "...")] attribute is added so serialization round-trips correctly. Integers map to i64, decimals to f64, booleans to bool, arrays to Vec<T>, and null/unknown values to serde_json::Value.