G
GoTool

Rust → JSON

Convert Rust Debug trait {:?} output to JSON

Input0
Examples:
Output
0

About Rust to JSON Converter

Convert Rust Debug trait formatted output ({:?} and {:#?}) to standard JSON. Supports structs, enums, tuples, Vec, HashMap, HashSet and other common Rust data types. Output from println!("{:?}", obj) or dbg!(obj) can be directly converted. All processing happens locally in your browser.

Frequently Asked Questions

What Rust data types are supported?

Named structs (User { name: "x" }), tuple structs (Point(1, 2)), enum variants (Some/None/Ok/Err), Vec/arrays, HashMap, HashSet, and more.

Can it handle {:#?} formatted output?

Yes, both {:#?} (pretty-print) and {:?} (single-line) formats are supported. The tool handles indentation and line breaks automatically.

How are Some and None converted?

Some(value) is unwrapped to the inner value, None is converted to JSON null. Ok(value) is also unwrapped.