Generate Rust Structs from API Response

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.

100% client-side. Your data never leaves your browser.

// 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[];
}
Send to:

Related Tools

Generate Rust Structs from API Response

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.

What You Get

The tool produces:

How to Use

  1. The example loads with a sample API response and Rust mode pre-selected
  2. Inspect the generated Rust structs and their serde attributes
  3. Copy the structs and paste them into your Rust project
  4. Replace with your actual API response to generate structs for your endpoints

Real-World Pattern

Rust 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.