JSON to Rust struct (serde)
Paste a JSON payload (an object or an array of objects) and get a Rust struct with Serialize/Deserialize derives. Fields that are missing or null in some records become Option<T> with skip_serializing_if, camelCase keys get a #[serde(rename)], and the struct stays dependency-free beyond serde (timestamps come out as String; chrono is your call).
Inferred from the payload you paste, on the server, discarded after the response.
Example
[
{"id": 1, "sku": "A-100", "name": "Widget", "price": 9.99, "in_stock": true, "created_at": "2024-01-15T10:30:00Z"},
{"id": 2, "sku": "B-220", "name": "Gadget", "price": 19.5, "in_stock": false, "created_at": "2024-02-01T08:00:00Z"}
]
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
pub struct Payload {
pub id: i64,
pub sku: String,
pub name: String,
pub price: f64,
pub in_stock: bool,
pub created_at: String,
}