JSON to Rust

Input
Output

JSON to Rust

Paste a JSON sample, such as an API response, and Bracely writes Rust structs with serde for it. Each object becomes a struct deriving Serialize and Deserialize, with #[serde(rename)] where needed.

How do I use the JSON to Rust?

  1. Paste a JSON sample.
  2. Set the root type name, for example Order.
  3. Copy the Rust code into your project.

What does the JSON to Rust do?

  • serde derives on every struct
  • i64, f64, String and Vec<T> picked from your data
  • Option<T> for fields that can be missing
  • Nested objects become their own named types
  • 20 other languages from the same sample, including TypeScript

Frequently asked questions

How does it pick Rust types?
From the values in your sample: whole numbers, decimals, text, true/false, arrays and nested objects. When array items disagree, the field is made optional or widened.
Can I generate other languages?
Yes. Change Language to any of the others: TypeScript, Go, Python, Pydantic, Java, C#, Kotlin, Swift, Scala, Ruby, Dart, PHP, Zod, TypeBox, Valibot, Yup, GraphQL, Protobuf, Prisma and Drizzle.
Is my data uploaded?
No. Bracely runs entirely in your browser, so nothing you paste or open leaves your device.

More JSON tools

Bracely has 108 JSON tools in one page. Related ones:

Runs entirely in your browser. Nothing you paste is uploaded. Made by Saurabh Pagrut · About · Privacy policy
Last updated · Version 6.7 · Changelog
Saurabh Pagrut on GitHub · LinkedIn · X · YouTube · Instagram