JSON to Rust Struct & Serde Converter

BeanTrans turns JSON payloads into idiomatic Rust structs with snake_case field naming, Option<T> nullable support, and automatic #[derive(Debug, Clone, Serialize, Deserialize)] plus #[serde(rename)] attributes—executed 100% locally in your browser.

Key Capabilities

  • Emits #[derive(Debug, Clone, Serialize, Deserialize)] and exact #[serde(rename = "...")] attributes for camelCase keys.
  • Supports nullable Option<T> fields and Vec<T> collections with clean nested struct extraction.
  • Zero network calls—safe for pasting private API responses, Tauri IPC payloads, and internal Rust models.

Type Mapping Reference

Source Target Notes
stringStringOwned Rust String
integeri32 / i64Controlled by Number Type
decimalf6464-bit IEEE float
null / optionalOption<T>Safe Rust optional wrapper
array<T>Vec<T>Heap-allocated vector

Frequently Asked Questions

Does BeanTrans automatically add Serde derives for Rust structs?
Yes. Derive Serialize/Deserialize is enabled by default in the Rust config panel and automatically annotates renamed camelCase keys with #[serde(rename)].
How are nullable JSON fields represented in Rust?
Null values and optional fields are wrapped in Option<T>, and you can force all fields nullable via the Nullable fields switch in Config.
Can I convert Rust structs back to TypeScript or JSON?
Yes. Click the divider swap button or set Source to Rust and Target to TypeScript, JSON, Go, or Protobuf.