Skip to content

Show HN: Generate Go structs from multiple JSON objects

github.com/twpayne
1 pointtwpdiscuss
On HN

If you need to unmarshal arbitrary JSON or YAML data (e.g. consuming data from a REST/JSON endpoint with no defined schema) then https://github.com/twpayne/go-jsonstruct will automatically create your Go structs for you. What's special about go-jsonstruct compared to other JSON-to-Go generators, is that go-jsonstruct can accept multiple documents as input and generate the most specific Go struct into which all of the documents can be unmarshalled. You can give it a few example responses from your REST/JSON endpoint and go-jsonstruct will infer the struct for you.

Comments

No comments yet.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.