Generate Rust structs with serde Serialize and Deserialize derives from a typical REST API JSON response. Paste your API JSON and get typed Rust structs.
// Generated by DevBento — json-to-typescript
interface RootAddress {
street: string;
city: string;
zip: string;
}
interface RootPostsItem {
title: string;
likes?: number;
}
interface Root {
id: number;
name: string;
email: string;
isActive: boolean;
roles: string[];
address: RootAddress;
posts: RootPostsItem[];
}This example generates Rust structs with serde derives from a typical REST API response. The pre-filled JSON represents a user object with nested address, array of roles, and array of post objects. Switch to Rust mode to see the generated structs.
The tool produces:
Root struct with all top-level fieldsRootAddress struct for the nested address objectRootPostsItem struct for array items#[derive(Serialize, Deserialize)] on every struct#[serde(rename)] attributes for keys that differ from snake_case field namesOption<T> for optional fields (like Posts items missing Likes)String, i64, bool, Vec<String>, serde_json::ValueRust structs with serde derives are the standard way to deserialize API responses in Rust. The generated code works directly with serde_json::from_str and serde_json::from_value. Use Option<T> for fields that may not always be present in the response.
Nothing you paste leaves this tab. Every tool runs entirely in your browser — no upload, no server, no account.