Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

mholt/json-to-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

80 Commits

Repository files navigation

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.

Usage

  • Read JSON file:

    node json-to-go.js sample.json
  • Read JSON file from stdin:

    node json-to-go.js < sample.json
    cat sample.json | node json-to-go.js

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.

About

Translates JSON into a Go type in your browser instantly (original)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Contributors 28

AltStyle によって変換されたページ (->オリジナル) /