☰
Home
/
Code Generators
/
JSON → Rust
🦀
JSON → Rust
Generate Rust serde struct from JSON
☆
Bookmark
Loading tool…
JSON input
{ "id": 1, "name": "Ada Lovelace", "email": "ada@example.com", "isActive": true, "score": 98.6, "tags": ["admin", "developer"], "address": { "street": "123 Main St", "city": "London" }, "orders": [{ "id": 101, "total": 49.99, "shipped": false }] }
Rust output
⧉ Copy
use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Address { pub street: String, pub city: String, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Order { pub id: i64, pub total: f64, pub shipped: bool, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Root { pub id: i64, pub name: String, pub email: String, #[serde(rename = "isActive")] pub is_active: bool, pub score: f64, pub tags: Vec<String>, pub address: Address, pub orders: Vec<Order>, }