JSON and data guides
Generate TypeScript and Go types from JSON samples
Review generated types for missing fields, mixed arrays, nullable values and numeric precision before using them in an API.
A sample shows observed values
A generator infers structure from the values it sees. It cannot know that a field is optional if every sample contains it.
Provide representative records and review the output. A single successful response does not cover error responses, empty arrays or alternative payload shapes.
{"id":"00123","name":"Ada","tags":["reader"],"note":null}Model absence and null separately
TypeScript optional properties and nullable unions describe different states. Go pointer fields can represent null, but omission semantics also depend on decoding and serialization.
Check how your API distinguishes an omitted field from a field explicitly cleared to null. Generated code does not define that business rule.
Check arrays and numbers
An empty array offers no evidence about its element type. Mixed arrays may require a union or a more explicit discriminated object model.
Use string identifiers where numeric arithmetic is unnecessary. JavaScript numbers, Go integers and decoder defaults have different overflow and precision boundaries.
Compile and validate the contract
Copy the result into the target project and compile it with the real compiler settings. TypeScript types do not validate untrusted runtime JSON.
Add runtime schema checks where needed and keep contract fixtures in tests. When the API evolves, regenerate deliberately and review the diff.