IEEE 754 Converter
See a float’s sign, exponent, mantissa and its exact decimal value.
Generate serde-ready Rust structs from a sample JSON document.
Needs serde = { version = "1", features = ["derive"] } in your Cargo.toml.
The rename attribute appears only where the snake_case name differs from the JSON key.
The JSON to Rust Struct converter writes serde-ready structs: a derive line with Serialize and Deserialize, snake_case fields, rename attributes only where the name actually differs, and Option<T> for keys that can be absent.
Paste a payload and get the structs, ready for serde: a derive line with Serialize and Deserialize, fields renamed to snake_case, and a serde rename attribute wherever the Rust name differs from the JSON key — and only where it differs, so the output stays readable.
Optional keys become Option<T>, which is how Rust represents a value that may not be there, and nested objects become their own structs declared alongside. Numbers are typed i64 or f64 depending on whether any decimal appears in the sample, and a value the sample cannot pin down falls back to serde_json::Value rather than guessing wrongly.
The serde attribute appears exactly where the snake_case Rust name differs from the JSON key, so the output stays readable.
A key missing anywhere in the sample becomes Option<T>, because serde returns an error rather than a default when a required field is absent.
Add Default, PartialEq or Clone to the derive line to match whatever your crate needs.
A field the sample cannot pin down becomes serde_json::Value rather than a wrong concrete type that fails at runtime.
Each nested object becomes its own named struct, so the whole payload is typed rather than half-typed.
An array of records gives better detection of optional fields.
Nested structs are named from the keys holding them.
Add or remove traits such as Default or PartialEq to match your crate.
Paste into a .rs file; add serde with the derive feature to Cargo.toml.
serde with the derive feature and serde_json: serde = { version = "1", features = ["derive"] } and serde_json = "1".
Because it is only needed when the snake_case Rust name differs from the JSON key. Adding it everywhere would be noise, so it appears exactly where it does something.
Because the key is missing or null somewhere in the sample. Without Option, serde returns an error on a payload that omits it.
Yes, and it is cleaner when every key follows one convention. Add #[serde(rename_all = "camelCase")] to the struct and delete the individual attributes.
What people who use the JSON to Rust Struct think of it. Reviews come from visitors and are posted as written.
No ratings yet
Yours would be the first.
0 reviews
Newest first
No reviews yet
Be the first to rate the JSON to Rust Struct. It takes half a minute and no account.
Write the first reviewSee a float’s sign, exponent, mantissa and its exact decimal value.
Draw a grid layout and get the CSS, including named template areas.
Sort JSON object keys alphabetically at every level, or sort arrays by a field.
Generate a CI workflow with caching, a version matrix and the right permissions.
Run JSONPath expressions against a document and see every match live.
Read a cron expression in plain English and see when it next runs.
Turn text into a block-letter ASCII banner for a README or a CLI.
Build a cron schedule from controls and see the next times it runs.