Paste any JSON and get ready-to-use Rust types in one click. Nested objects, arrays, optional fields and awkward key names are handled for you, and everything runs in your browser, so API responses and sample payloads are never uploaded.
Root.JSON input
{
"id": 1,
"name": "Alice",
"active": true,
"score": 98.5,
"tags": ["admin"],
"address": { "city": "New York" }
}Rust output
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
pub struct Root {
pub id: i64,
pub name: String,
pub active: bool,
pub score: f64,
pub tags: Vec<String>,
pub address: Address,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Address {
pub city: String,
}| JSON | Rust |
|---|---|
| string | String |
| whole number | i64 |
| decimal number | f64 |
| boolean | bool |
| array | Vec<T> |
| object | a struct |
| null / unknown | serde_json::Value |
Fields are snake_case. If the result is a Rust keyword (like type) it gets a trailing underscore, and #[serde(rename = "original")] keeps deserialization working.
let root: Root = serde_json::from_str(&data)?;Describe the same data with the JSON Schema generator, get TypeScript interfaces, create a SQL table, fix broken input with JSON Repair, or compare payloads with JSON Diff.
Paste your JSON and copy the code. Objects become pub structs deriving Debug, Serialize and Deserialize, arrays become Vec<T>, whole numbers become i64 and decimals become f64.
Field names are converted to snake_case. If the result is a Rust keyword (like type) it gets a trailing underscore, and a #[serde(rename = "original")] attribute keeps deserialization working.
Fields that are null or missing in some array items become Option<T>. Values whose type cannot be inferred use serde_json::Value. Add serde and serde_json to Cargo.toml. Everything runs in your browser — your JSON is never uploaded to a server.