Serde AttributesSnake Case100% Private
use serde::{Serialize, Deserialize};

#[derive(Debug, Serialize, Deserialize)]
pub struct Root {
    pub id: i64,
    pub name: String,
    pub email: String,
    pub active: bool,
    pub score: f64,
    pub address: Address,
    pub tags: Vec<String>,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct Address {
    pub street: String,
    pub city: String,
}

FAQ

Are serde attributes included?
Yes. All structs include #[derive(Debug, Serialize, Deserialize)]. Fields that need renaming get #[serde(rename = "...")].
How are field names converted?
CamelCase and kebab-case JSON keys are automatically converted to Rust snake_case, with serde rename attributes to maintain JSON compatibility.
What types are inferred?
String, i64, f64, bool, Vec<T>, and nested struct types are inferred. Null values become Option<serde_json::Value>.
Share:

Love this tool? Explore 999+ more

Free online tools for images, PDFs, text, code, and more. All running in your browser.

Explore All Tools