A command-line tool that automatically generates Go struct definitions from JSON or YAML documents.
gojson is a Go-based command-line tool that automatically generates accurate Go struct definitions from example JSON or YAML documents. It simplifies working with external data formats in Go applications by automating the creation of type-safe data structures, saving developers time and reducing manual errors.
Go developers who need to integrate with JSON or YAML APIs or data sources, particularly those working on applications that consume external RESTful services, configuration files, or data serialization tasks.
Developers choose gojson for its simplicity and accuracy in automating a repetitive task, offering a CLI that processes input from files, stdin, or URLs with support for custom struct naming and both JSON and YAML formats.
Automatically generate Go (golang) struct definitions from example JSON
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Converts JSON or YAML input into ready-to-use Go structs with accurate field types and JSON tags, as demonstrated in the README example using GitHub API data to generate a detailed Repository struct.
Operates as a command-line tool that processes data from files, standard input, or URLs, enabling easy integration into scripts and development workflows, as shown with the curl pipe example.
Handles both JSON and YAML document formats for input, providing flexibility for different data sources commonly used in Go applications.
Can be installed via `go get` and used directly in the PATH, making it straightforward for Go developers to incorporate into their toolchain without complex setup.
Often defaults to float64 for numeric fields (e.g., 'forks' as float64 in the example), which may not be optimal for integer types and requires manual adjustment after generation.
Focuses solely on struct definition without built-in support for generating methods, interfaces, or custom validation code, as implied by its simplicity-focused philosophy in the README.
Distributed under GPL v3, which may impose copyleft restrictions on use in proprietary projects, though the README notes output is not affected, the tool itself is GPL-licensed.