mholt / json-to-go

Translates JSON into a Go type in your browser instantly (original)
https://mholt.github.io/json-to-go/
MIT License
4.5k stars 474 forks source link

Add flatten option for non-anonymous structs #47

Closed mike-hosseini closed 5 years ago

mike-hosseini commented 5 years ago

This commit addresses #35. In order to, generate non-anonymous structs, set the default value for flatten variable in jsonToGo() to true. Let me know if you find any issues.

mholt commented 5 years ago

Do you think you could help with one bug I found? If you try the example for GitHub, you'll notice that it makes two Permissions structs. Ideally, we wouldn't repeat types...

mike-hosseini commented 5 years ago

Sure thing, I will look into it now!

mike-hosseini commented 5 years ago

Submitted a new PR https://github.com/mholt/json-to-go/pull/49. Please let me know if you find any new issues. :)