How JSON Copilot infers TypeScript interfaces
Inference is structural: the converter reads the values in your sample and derives a type for each one. A plain object becomes an exported interface. Each nested object gets its own interface, named by converting the key to PascalCase — an address key produces an Address interface, and the parent field references it as address: Address. Naming collisions are resolved by appending a number, so two differently shaped user objects would become User and User2.
Arrays are typed by the elements they hold. An array of strings becomes string[], and an array of objects is collapsed into one interface that is referenced as, for example, Order[]. When an array contains objects with differing keys, they are merged into a single interface rather than a union of interfaces: every key seen across the items is included, and any key not present in all of them is marked optional with a ? suffix.
Primitive values map to number, string, or boolean. When a field holds more than one primitive type across the sample, the result is a union such as string | number, and arrays of mixed primitives are wrapped as (string | number)[]. A value that is sometimes null adds | null to its type, and the root object is emitted as an interface named Root alongside every nested interface it depends on.