JSON to Rust Struct
Convert JSON data to Rust serde structs using quicktype engine. Auto-infers Option/Vec types, ready to use.
Usage
Features
Based on quicktype engine, this tool automatically converts JSON data to Rust serde struct definitions with type inference and Option type auto-detection.
Steps
Enter or paste JSON data in the left text box, set the root type name, adjust field visibility and code density. Rust code will be generated in real time.
Options
- Field visibility: controls struct field visibility modifiers - private (default), crate, or public.
- Code density: standard mode writes fields on separate lines; dense mode compresses into tighter layout.
- Derive Debug/Clone/PartialEq: adds derive macros for the corresponding traits.
- Skip None serialization: skips Option fields with None values during serialization.
Notes
Requires serde dependency in Cargo.toml. Numbers inferred as i64 or f64. null fields become Option type.