Web Tools
JSON to Rust Serde
Convert JSON data to Rust struct definitions with serde derive macros. Infer nested structs, Vec types, Option for null, and configurable rename_all strategies. Runs entirely in your browser — your data never leaves your machine.
json rust serde converter struct code-generator
Published May 29, 2026
All interactive tools run entirely in your browser. Your data never leaves your device.
How It Works
Paste any JSON data and instantly get Rust struct definitions with #[derive(Serialize, Deserialize)] and serde attributes. The tool infers types from values, handles nested objects, arrays, null (as Option), and mixed types. Configure the root struct name, derive traits, field visibility, and rename_all strategy.
Features
- Serde derive macros: automatic
#[derive(Serialize, Deserialize, Debug, Clone)] - rename_all support: camelCase, snake_case, PascalCase, SCREAMING_SNAKE_CASE, kebab-case, or none
- Nested struct inference: objects within objects generate separate named structs
- Accurate type mapping: String, i64, f64, bool, serde_json::Value
- Option for null: null values become
Option<serde_json::Value> - Vec handling: homogeneous arrays get typed elements, mixed arrays use
serde_json::Value - pub field toggle: control field visibility
- 5 example payloads: simple, nested, array, API response, config file
- Private: runs entirely in the browser — no data transmitted
Use Cases
- Quickly generating Rust structs for API response data
- Bootstrapping serde-compatible types from JSON fixtures
- Converting JSON config files to typed Rust configurations
- Learning how JSON structures map to Rust types