Rust Struct to JSON Schema Generator

Need JSON to Rust?

Convert JSON data to Rust code

JSON → Rust Structs

Rust code Input

Loading...

JSON Schema Output

Paste your Rust structs to produce JSON Schema instantly.

Supports Option<T>, Vec<T>, HashMap/BTreeMap, serde rename attributes, and nested structs.

Frequently Asked Questions

What Rust syntax is supported?

Named structs with public fields, nested structs, Option<T>, Vec<T>, arrays, HashMap/BTreeMap, references, lifetimes (ignored for schema), and serde annotations like #[serde(rename = "...")] are supported. Enums are skipped for now, so paste the struct types that represent your JSON payloads.

How are Rust types mapped to JSON Schema?

Primitive types such as String, bool, integers, floats, chrono::DateTime, and uuid::Uuid map to JSON Schema primitives. Vec<T> becomes arrays, HashMap<string, T> becomes objects, and Option<T> automatically marks the field optional.

Does the conversion run locally?

Yes. Everything runs inside your browser, so your Rust code never leaves your machine. Paste structs directly from your project and select the root struct in the settings panel.

How do I get mock JSON payloads?

After the schema is generated, click "Generate Mock Data" to open the Mock Generator with the schema preloaded. Configure locales, array counts, and optional fields to create sample payloads instantly.