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.
Private & free — this tool runs entirely in your browser.
Recommended: IndieKit — Ship your Next.js startup in days.affiliate
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.
HWB to HEX Converter
Convert an HWB color to HEX.
JSON to SQL
Turn a JSON array of objects into SQL INSERT statements.
CSV to XML
Convert CSV rows into structured XML records.