Convert JSON to Rust Struct
Paste a JSON payload and get Rust structs ready for serde — correct field types, nested structs, Option for nullable fields, and Vec for arrays. Everything runs locally in your browser; your JSON is never uploaded.
JSON Source
Rust Struct
Ready.
How to use
- Paste your JSON object (or an array to infer the element type) into the input panel.
- Click Convert to Rust — the structs are generated entirely in your browser.
- Review the derived types: Option<T> for nullable fields, Vec<T> for arrays, nested structs for objects.
- Add `use serde::{Serialize, Deserialize};` and paste the structs into your crate.
Common use cases
- Deserializing a third-party JSON API into typed Rust structs with serde_json.
- Modelling config files or fixtures as structs instead of working with serde_json::Value.
- Bootstrapping request/response types for an axum or actix web service.
Frequently asked questions
- Does it use serde?
- Yes — the output is shaped for serde with `#[derive(Serialize, Deserialize)]`, so it works directly with serde_json::from_str.
- How are nullable and array fields handled?
- Null or missing values become Option<T>, and JSON arrays become Vec<T> with the inferred element type.
- Is my JSON uploaded anywhere?
- No. Conversion runs 100% client-side via WebAssembly, so it works offline and is safe for sensitive payloads.