Introducing structr: A CLI tool to generate Rust structs from JSON
I've just released structr, a CLI tool that automatically generates typed Rust structs from JSON input. It supports:
- Generating proper Rust types based on JSON data
- Taking multiple JSON samples to create complete schemas
- Handling nested objects and arrays
- Web framework integration (Actix, Axum, Rocket)
- GraphQL support (both async-graphql and juniper)
#Installation
cargo install structr
Simply pipe in your JSON or point it to a file, and get a ready-to-use struct with proper serialization.
cat data.json | structr --name User
# or
structr --input data.json --name User
Give it a try and let me know what you think! https://github.com/bahdotsh/structr