JSON to Rust Struct
Generate Rust structs with serde Serialize / Deserialize derives from a JSON sample.
Rust structs
JSON to Rust struct generator
Paste a representative JSON object and this tool generates matching Rust structs with #[derive(Debug, Clone, Serialize, Deserialize)] and serde field rename attributes where the JSON key differs from snake_case. Field names are converted to snake_case, nested objects become their own named structs, and numbers map to i64 or f64 based on the sample value. Pass an array and the first element defines the shape.
Add serde = { features = ["derive"] } to your Cargo.toml to use the generated code. Working in Go instead? Try JSON to Go Struct, or JSON to TypeScript for frontend projects.
Related Converters tools
JSON to YAML
Convert JSON into clean, readable YAML instantly.
YAML to JSON
Convert YAML configuration into valid JSON.
JSON to CSV
Flatten a JSON array of objects into CSV rows.
CSV to JSON
Parse CSV with headers into a JSON array of objects.
JSON to XML
Convert JSON structures into nested XML markup.
JSON Minifier
Strip whitespace to produce compact JSON.
JSON to TypeScript
Generate TypeScript interfaces from a JSON sample.
JSON to SQL
Turn a JSON array of objects into SQL INSERT statements.