JSON to Rust Serde struct converter tool icon
Data & JSON tools

JSON to Rust Serde struct converter

Infer Rust struct fields with serde attributes from sample JSON, supporting Option and Vec types. Everything runs locally in your browser, ideal for modeling API responses and data structures.

JSON input
Notes: mixed types or arrays fall back to serde_json::Value; missing or null fields become Option. All processing runs locally in your browser.
Rust output

Usage & Instructions

1. Paste your JSON data into the input box on the left, or click "Format JSON" to tidy it up. 2. Set the root struct name in the top input field (default is Root). 3. The tool automatically infers field types and generates Rust struct code with Serde attributes. 4. Null or missing fields become Option<T>, and arrays are inferred as Vec<T>. 5. Click "Copy Rust Code" to copy the result to your clipboard.

Tips

**Local Processing** All conversions happen entirely within your browser via JavaScript. No data is sent to any server, ensuring your privacy.

**Smart Type Inference** Handles nested objects, arrays, and mixed types (falling back to serde_json::Value). Automatically adds `#[serde(rename = "...")]` for fields that don't match Rust naming conventions.

**Serde Integration** Generated code includes `use serde::{Deserialize, Serialize};` and derives `Debug`, `Clone`, `Serialize`, `Deserialize` for all structs, ready for production use.

Go Map ↔ JSON

Go Map ↔ JSON

Convert Go map fmt output to readable JSON and back again directly in your browser so you can paste data into Go code or documentation without sending anything over the network.

TOML Convert

TOML Convert

Convert between TOML and JSON with optional pretty JSON output, fully in-browser with no data uploads.

XML to JSON

XML to JSON

Free online XML to JSON Converter. Smartly parses XML documents to JSON with custom indentation and attribute handling.

JSON formatter

JSON formatter

Format or minify JSON locally with custom indentation and optional key sorting.

JSON compare

JSON compare

Recursively compare two JSON values and list added/removed/changed/type-changed differences.

CSV to JSON

CSV to JSON

Convert CSV to JSON locally in your browser with configurable delimiter and header handling. Ideal for API testing and data import tasks.

Excel to JSON

Excel to JSON

Parse Excel workbooks locally and export sheets as JSON with optional header row detection. No files are uploaded.

JSON to CSV

JSON to CSV

Convert JSON arrays of objects to CSV locally, flattening nested fields into columns. Perfect for spreadsheets and BI tools.

JSON to Excel

JSON to Excel

Export JSON arrays of objects to .xlsx files locally in your browser with custom sheet and file names.

JSON \u2194 YAML converter

JSON \u2194 YAML converter

Convert between JSON and YAML locally in your browser with configurable JSON indentation and one-click copy for config editing.

JSON to C# class

JSON to C# class

Infer C# property types from sample JSON and generate class definitions with support for List<T>/arrays, JsonPropertyName attributes and nullable reference types, all processed locally in your browser.

JSON to Go Struct

JSON to Go Struct

Infer Go struct types from sample JSON and generate struct definitions with json tags and omitempty support for partially present fields, all processed locally in your browser.

JSON to TypeScript

JSON to TypeScript

Infer TypeScript types from sample JSON and generate interface/type declarations with support for nested objects, arrays and union types, all processed locally in your browser.

JSON to Java POJO

JSON to Java POJO

Infer Java POJO field types from sample JSON and generate class definitions with List<T>/array support, optional @JsonProperty annotations and nested static classes, all processed locally in your browser.

JSON to Python model

JSON to Python model

Infer Python Pydantic BaseModel fields from sample JSON and generate models with Optional, List, Any and alias mapping support, all processed locally in your browser.

JSON to Kotlin data class

JSON to Kotlin data class

Infer Kotlin data class fields from sample JSON and generate type-safe models with List, nullable types and optional kotlinx.serialization annotations, all processed locally in your browser.

JSON diff viewer

JSON diff viewer

Visually diff two JSON values with a recursive tree, showing added, removed, changed and type-changed nodes, with hide-equal and copyable diff list, all processed locally in your browser.

JSON Schema Validator

JSON Schema Validator

Validate JSON data against a JSON Schema locally in your browser, with clear error paths and messages for type, required, enum, const, min/max, pattern and more. $ref is not resolved.

JSON to JSON Schema

JSON to JSON Schema

Generate JSON Schema from sample JSON locally in your browser, including type/properties/required/items and optional additionalProperties=false for API definitions and documentation.

INI / YAML / JSON converter

INI / YAML / JSON converter

Convert between INI, YAML, and JSON locally in your browser with basic validation and optional pretty-printed JSON output, ideal for config migrations and debugging.