WebTool

JSON to Rust

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

Privacy: all processing happens locally in your browser. Your input never leaves your device.

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-04