GUIDE

Types from document examples

Turn a sample into a useful starting point, without mistaking it for a complete contract.

On this page

Choose a representative example

JSON (JavaScript Object Notation) records the values you supply. Generate types from an example containing the fields and value variations your application needs. One sample cannot prove which fields may be absent or change type.

{"name":"Ada","count":2,"tags":["local"]}

Pick the target language

TypeScript produces types and interfaces. Go produces structures with document field tags. Python produces classes with type hints; generated identifiers can differ from document keys, and no serializer is included.

Review the inferred result

Empty arrays and null give little information. Mixed arrays can produce union or general types. Generated types do not validate future input at runtime. Inspect the result and adapt it to your real data contract.

Keep exact identifiers

Duplicate document keys and unsafe integers are rejected. Quote large identifiers as strings. Root names are limited to 64 letters, digits or underscores and must start with a letter; language-specific names may be adjusted.