JSON to Rust

Free online JSON to Rust converter: generate serde structs with derives, snake_case fields, rename attrs and Vec<T>.

Data handling: common local tools process inputs in your browser; network queries, server execution and optional AI follow their separate data-use notes.

What is JSON to Rust?

Rust's serde ecosystem requires precise struct definitions for JSON. This tool generates structs with #[derive(Serialize, Deserialize)] from a sample JSON: fields use snake_case, a #[serde(rename)] attribute is added whenever a name differs from the original key, integers map to i64, arrays to Vec<T>, and nested objects become separate structs.

How to Use

  1. Paste a sample JSON
  2. Rust structs are generated automatically
  3. Copy into your project (requires the serde and serde_json dependencies)

FAQ

What does null map to?
Option<serde_json::Value>. Replace it with Option<T> of a concrete type according to the documentation.

Related Tools

Last updated 2026-09-15