Skip to content
Translates JSON into a Go type in your browser instantly
JavaScript
Branch: master
Clone or download
This branch is 14 commits behind mholt:master.

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
json-to-go.js
sample.json

README.md

JSON-to-Go converts JSON to a Go struct

Translates JSON into a Go type definition. Check it out!

This is a sister tool to curl-to-Go, which converts curl commands to Go code.

Things to note:

  • The script sometimes has to make some assumptions, so give the output a once-over.
  • In an array of objects, it is assumed that the first object is representative of the rest of them.
  • The output is indented, but not formatted. Use go fmt!

Contributions are welcome! Open a pull request to fix a bug, or open an issue to discuss a new feature or change.

Credits

JSON-to-Go is brought to you by Matt Holt (mholt6).

The Go Gopher is originally by Renee French. This artwork is an adaptation.

You can’t perform that action at this time.