At times the JSON you want to work with in Go can have large numbers of elements in objects and/or deeply nested objects of different types. Manually writing the appropriate Go
structs that correctly unmarshal and marshal the JSON can become tedious and error prone.
The following tools automate this process by generating Go
structs from a sample of the JSON the Go code needs to handle.
JSON to Go Struct¶
Website based on JSON-to-Go that includes tools to prettify the JSON and fetch JSON from a URL along with other JSON conversion utilities.
Website where you paste in an example of the JSON you need to parse. The site will generate the Go struct(s) (with tags) that will work for that JSON.
Command line tool and package that generates a Go struct that will work for the example JSON given to it.
Command line tool that takes the JSON given to it on stdin and writes a compatible Go struct on stdout.
Multifunction command line tool that can:
- escape text so it can be used as a JSON string
- format JSON data (compact or pretty)
- sort fields of JSON objects
- generate a Go struct that is suitable for working with the JSON input
As I find more tools, I will update this page. To be notified when this page is updated, please subscribe.