JSON to Rust Struct Converter (serde)
Developer
Paste any JSON object or array and get ready-to-use Rust `struct` definitions deriving `Serialize, Deserialize` from serde, with fields mapped to Rust types (String, i64, f64, bool, Vec<...>) and separate structs for nested objects. Keys that aren't snake_case get a `#[serde(rename = "...")]` attribute. Everything runs locally in your browser — your JSON is never uploaded.
How to use
- Paste or type your JSON into the input box.
- Optionally rename the root struct (defaults to AutoGenerated).
- Copy the generated structs from the output box and add serde to your Cargo.toml.
Frequently asked questions
- How are numbers typed?
- Whole numbers become i64 and numbers with a decimal point become f64. Adjust manually if you need u32, i32 or another width.
- What happens with null or empty arrays?
- null values map to Option<serde_json::Value> and empty arrays to Vec<serde_json::Value>, since their type can't be inferred from the sample.
- Why do some fields have a serde rename?
- Rust fields use snake_case. When a JSON key differs (for example camelCase), a #[serde(rename = "...")] attribute is added so serialization still matches the original key.
- Is my JSON sent anywhere?
- No. Conversion happens entirely in your browser; nothing is uploaded.
Related tools
Base64 to Hex Converter (and back)
Convert a Base64 string to hexadecimal bytes and hex back to Base64, with URL-safe support, in your browser.
Quoted-Printable Encoder & Decoder
Encode text to MIME Quoted-Printable (RFC 2045) or decode it back — handling =XX escapes, soft line breaks, and UTF-8 — entirely in your browser, with 76-character line wrapping on encode.
Hash Generator (SHA)
Generate SHA-1, SHA-256, SHA-384, and SHA-512 hashes from text.
URL Encoder / Decoder
Percent-encode text for URLs, or decode encoded URLs back to text.
Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to text, instantly.
JSON Formatter & Validator
Format, beautify, minify, and validate JSON right in your browser.