JSON → Rust Struct
Generate Rust structs from JSON with #[derive(Serialize, Deserialize, Debug)]. Snake_case fields with #[serde(rename)] where needed.
Root struct name
JSON input
Rust output
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug)]
pub struct Address {
pub street: String,
pub city: String,
pub zip: String,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct Order {
pub id: i64,
pub total: f64,
pub items: Vec<String>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct Root {
pub id: i64,
#[serde(rename = "userName")]
pub user_name: String,
pub email: String,
pub active: bool,
pub score: f64,
pub address: Address,
pub tags: Vec<String>,
pub orders: Vec<Order>,
pub metadata: Option<serde_json::Value>,
}Related tools
JSON to TypeScriptCode
Generate TypeScript interfaces or types from JSON input.
JSON to Go StructCode
Generate Go structs from JSON with proper json tags.
JSON to Python DataclassCode
Generate Python dataclass code from JSON with type hints.
JSON to Java POJOCode
Generate Java POJO classes from JSON with getters, setters, and constructors.
JSON to C# ClassesCode
Generate C# classes from JSON with public properties and using statements.
JSON to Zod SchemaCode
Generate Zod validation schemas from JSON objects with proper TypeScript types.