Generates Go struct definitions from JSON server responses, supporting parametric routes and custom headers.
RTS (Request to Struct) is a Go tool that automates the creation of Go struct types by analyzing JSON responses from a server. It streamlines API integration by eliminating the manual and error-prone process of writing struct definitions, making it especially useful for developers working with RESTful APIs.
Go developers who need to consume JSON APIs, particularly those working with RESTful services and wanting to automate the generation of type-safe data models.
Developers choose RTS because it automates a repetitive and error-prone task, generates struct names intelligently from route patterns, and supports batch processing from files or single JSON payloads from stdin, saving time and reducing boilerplate code.
RTS: request to struct. Generates Go structs from JSON server responses.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Automatically converts URL patterns like `/users/:id` into struct names such as `UsersId`, making generated code context-aware and organized based on API routes.
Handles dynamic URL parameters by allowing value specification (e.g., `/users/:user 1`), enabling struct generation from actual API calls with real data.
Supports custom HTTP headers via the -headers flag, so it can access protected endpoints requiring authorization tokens or other security measures.
With the -substruct flag, it creates separate Go types for nested JSON objects, promoting cleaner, reusable code instead of anonymous structs.
Only generates standard `json` tags; lacks support for custom tags like `db`, `xml`, or validation tags, which limits integration with databases or other frameworks.
Requires a live server to fetch JSON responses, making it unsuitable for offline development or when APIs are down, with minimal error handling for failures.
Offers few options for tweaking generated structs, such as handling optional fields with pointers, custom type mappings, or controlling naming conventions beyond route conversion.