JSON to Rust Struct Generator
Paste a JSON sample on the left, get serde-ready Rust types on the right — structs with #[derive(Deserialize, Serialize)] and #[serde(rename)] attributes so they work directly with serde_json.
How to use this tool
Paste a representative JSON sample into the input on the left.
Rust types appear on the right after the quicktype engine loads (first run only — subsequent runs are instant).
Copy the output into a .rs file. The root struct is named Root by default; rename it to match your domain.
Generated structs derive Deserialize and Serialize with serde rename attributes for camelCase keys. Nested objects become nested structs; arrays become Vec<T>.
Everything runs in your browser — safe to use with internal API responses.
Frequently asked questions
Is serde support included?
Yes. Every struct derives Deserialize and Serialize, and fields get #[serde(rename = "...")] so snake_case Rust fields map to camelCase JSON keys.
How are numbers typed?
Integers map to i64 and decimals to f64. quicktype infers the narrowest type that fits every observed value.
How are nulls handled?
Fields that appear as null become Option<T>, letting you distinguish absent from zero values.
Can I generate other languages?
Yes — TypeScript, Go, Java, C#, and Python generators are also available, each with its own tool page.
Is this private?
Completely. quicktype runs in your browser; no JSON is uploaded to any server.