Open huge JSON files instantly. Free & private.🔒 Your data never leaves your browser

JSON to Rust

Paste JSON and get Rust structs with serde Serialize/Deserialize, snake_case fields, rename attributes and Option for missing keys.

JSON
Rust

How the Rust structs are built

  • Structs derive Serialize and Deserialize for serde. Fields use snake_case with #[serde(rename = "…")] when the JSON key is different.
  • Keys that can be missing or null become Option<T> with default, and are skipped when serializing.
  • Whole numbers become i64, decimals f64. Mixed or unknown values become serde_json::Value.

Parse JSON with serde_json

# Cargo.toml
[dependencies]
serde = { version = "1", features = ["derive"] }
serde_json = "1"
let data: Root = serde_json::from_str(&json)?;
println!("{:?}", data);

Smart type detection

Objects inside arrays are merged into one type, so a key that appears in only some items is still included (as optional). Names come from the keys, and plural keys become singular: comments → Comment. Whole numbers and decimals in the same field become a decimal type. Everything runs in your browser; your JSON is never uploaded.

More free tools