glideapps / quicktype

Generate types and converters from JSON, Schema, and GraphQL

Home Page:https://app.quicktype.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python JSON generation

mikeb530 opened this issue · comments

Hello,

I ran into an issue with the generation of the class code. The generator indicated a field value of 0.0 as an int instead of a float.

I was able to add a new function:
def from_float(x: Any) -> float:
assert isinstance(x, float)
return x

After adding this to the generated code and it worked just fine afterward!

Thanks for making this, saved me a lot of time and it is really well done.