Generated from one sample, so treat optionality and numeric widths as a first draft.
Generated from one sample, so treat optionality and numeric widths as a first draft.
Turning an API response into model classes by hand is busywork. Paste the payload and get types for your language, with the serialisation attributes that language expects. Array elements are merged before generating, so a key that appears in only some elements becomes an optional field rather than being lost — the mistake most generators make when they read only the first element.
C#, TypeScript, Dart, Kotlin, Java, Python and Go, each with idiomatic naming.
JsonPropertyName, SerialName, JsonProperty, json tags — the annotation your stack expects.
A key missing from some array elements becomes an optional or nullable field, not a lost one.
Nested objects become their own classes, singularised from the property that held them.
C#, TypeScript, Dart, Kotlin, Java, Python and Go. C# emits [JsonPropertyName], Kotlin @SerialName, Java @JsonProperty, Go json tags with omitempty, and Dart gets fromJson/toJson methods.
A key missing from any element of an array is treated as optional: nullable in C# and Kotlin, `?` in TypeScript, Optional[...] with a default in Python, a pointer in Go.
integer and floating-point values in the same position widen to the language's floating type. Genuinely mixed types (a string and an object, say) fall back to the language's open type — object, unknown, dynamic or interface{}.