Convert JSON to Rust structs with serde Serialize/Deserialize derive macros.
Free online JSON to Rust struct generator. Paste any JSON object and get Rust struct definitions with #[derive(Debug, Serialize, Deserialize)] macros, serde rename_all attributes, Option<T> for nullable/optional fields, Vec<T> for arrays, and snake_case field naming. Perfect for Rust developers building REST API clients or data serialization code. Runs entirely in your browser.
Keywords: json to rust, json to rust struct, rust serde generator, rust struct from json, serde deserialize json, rust json types, rust struct generator, json rust converter, serde derive json, rust api struct, tokio rust json struct
Tags: json, rust, struct, serde, converter, generator
Paste valid JSON into the input area on the left.
Set the root struct name (defaults to 'Root') using the option field.
Toggle Serde derives (Serialize, Deserialize), Debug derive, and the serde rename_all convention.
Click Convert or press ⌘↵ (Mac) / Ctrl+Enter (Windows) to generate Rust structs.
Copy the generated Rust code or download it as a .rs file.
Generates idiomatic Rust structs from any JSON object or array.
Supports nested objects — creates separate named structs for each nested structure.
Optional #[derive(Serialize, Deserialize)] for serde JSON support.
Optional #[derive(Debug)] for easy debug printing.
Optional #[serde(rename_all = "camelCase")] or snake_case renaming to map Rust field names to JSON keys.
Smart type inference: String, f64, bool, Vec<T>, Option<T>, and nested struct types.
Works entirely in your browser — JSON never leaves your device.
Keyboard shortcut ⌘↵ for instant conversion.