Closed schollz closed 5 years ago
The latest commit has resolved this, you have to wait till it gets deployed at https://mholt.github.io/json-to-go/
These are my outputs, with and without the inlining:
type AutoGenerated struct {
Array []struct {
Word string `json:"word"`
} `json:"array"`
}
type AutoGenerated struct {
Array []Array `json:"array"`
}
type Array struct {
Word string `json:"word"`
}
Awesome! Thanks for your help
You're welcome!
Just deployed it
I love this tool and love the recent upgrade to split out the different struct types!
I ran into a possible bug with arrays of structs, though. I want to fix it but I'm not sure how and could use some pointers.
I tried this minimal JSON where
array
contains an array of a struct{"word":"X"}
:which will give me the following Inline definition:
Word
doesn't have a type (it should bestring
).2:11: expected type, found 'STRING'
I haven't seen this problem anywhere else, except when I have the array of structs.