Skip to content
ZeroServer.tools

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