JSON to Rust Struct
Convert JSON data to Rust structs with serde serialization annotations. Auto-generate correct types and snake_case naming.
Input
Output
Rust struct will appear here
What is JSON to Rust Struct?
JSON to Rust struct tool can automatically generate Rust struct definitions with serde macros based on JSON data. Generated code includes #[derive(Debug, Serialize, Deserialize)] macros, correct type mappings (String, i64, f64, bool, etc.), and #[serde(rename = "...")] attributes to handle mapping between JSON key names and Rust snake_case naming. The tool supports nested object generation for nested structs, and array types automatically convert to Vec.
When to Use JSON to Rust Struct
Use when processing JSON data in Rust projects, building API client data models, working with reqwest and serde_json libraries, or creating type-safe configuration loaders.
How to Use JSON to Rust Struct
Paste JSON data into the input area. Enter the root struct name (optional, defaults to Root). Click the "Convert" button, and the generated Rust struct code will be displayed in the output area, including necessary use statements.
Related Tools
JSON Formatter & Validator
Format, beautify, minify, and validate JSON data instantly in your browser with syntax highlighting and tree view.
CSV to JSON Converter
Convert CSV and TSV spreadsheets to structured JSON instantly. Auto-detect delimiters, support custom headers, and preview before conversion.
YAML to JSON Converter
Convert YAML configuration files to JSON format instantly with validation and syntax error reporting for both formats.