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.51k stars 475 forks source link

Names that contain '.0' are preserved #72

Closed jheimbach closed 4 years ago

jheimbach commented 4 years ago

fixes #63

I saw the messages on the gopher slack and had a little time to investigate.

Your hack that guarantees that floats stay floats was checking every occurence of .0.

The regex searches now for occurences of :<somethings>.0 and replaces it with :<something>.1

relistan commented 4 years ago

Thanks for the PR!

I'm indifferent about the issue, personally -- I didn't introduce this feature -- so I will page the author of this line and see if he has any feedback: @relistan

Looks good. Looks like #63 is actually the possible issue with the original implementation that I described in #9. This fix looks good except that we need to take @mholt 's suggested change. Should validate with both pretty-printed input and non-pretty-printed.

mholt commented 4 years ago

Thanks for chiming in @relistan! Looks like we can wrap this up easily enough.

jheimbach commented 4 years ago

I updated the regex.