format · validate · convert · runs locally

JSON to Rust

Paste JSON and get Rust structs with serde Serialize/Deserialize derives, inferred field types (i64, f64, bool, String, Vec, Option), and nested structs. Copy or download the .rs. Runs in your browser.

Frequently asked questions

Does it add serde derives?

Yes — every struct is annotated with #[derive(Serialize, Deserialize)] so it works directly with serde_json.

What types does it infer?

Whole numbers become i64, decimals f64, strings String, booleans bool, arrays Vec<T>, and null becomes Option<serde_json::Value>.

How are nested objects handled?

Each nested JSON object becomes its own named pub struct, referenced by field.