JSON to F#
Convert any JSON object into an F# record type. Nested objects become separate types, names are converted to idiomatic F# casing, and the whole thing runs locally in your browser — no upload, no API key, no signup.
JSON in, F# out
The generator reads each key, infers a type from the sample value, and emits a typed F# structure with idiomatic naming.
{
"id": 1,
"name": "Alice",
"email": "alice@example.com"
}type Root = {
Id: int64
Name: string
Email: string
}What you'll use this for
Skip the boilerplate. Drop a JSON sample in, get back ready-to-paste F# types with sensible field names and structure.
API client scaffolding
You found a JSON response in the docs. Paste it here, get types you can drop into your client.
Config & fixtures
Generate types for config files, test fixtures, or any structured data you read at runtime.
Cross-language porting
Port a schema from another language by going through JSON as the lingua franca.
Private, local-only
JSON never leaves your browser. No upload, no API key, no signup.
How to generate F# from JSON
Paste your JSON
Drop a real sample into the left editor. The richer the example, the better the inferred types.
Set the root type name
Default is Root. Use whatever makes sense — User, ApiResponse, etc.
Click Generate
Or leave auto-generate on. Output appears instantly on the right.
Copy or download
Copy to clipboard or save as .fs and drop it into your project.
Frequently asked questions
Nested objects become their own separate types (or classes/structs/records). The top-level object references each nested type by name, and each is generated independently so you can compose or extract as needed.
JSON does not carry "optional" as a concept — only present-or-absent keys. Generate the output from an example that contains the optional fields and treat them as required (or hand-edit afterwards). Round-trip safety is up to your downstream code.
Yes. No signup, no limits, no ads, no upload. Everything runs in your browser.
Each leaf value gets a type based on its sample: strings stay strings, integers vs. floats are distinguished by whether the JS value is an integer, booleans stay booleans, and arrays use the first element\u2019s type. Nested objects become new typed records.
No — this generator is one-way (JSON to type definition). It produces type signatures, not parsing/serialization code. Pair it with your language\u2019s native JSON library.
About this generator
This tool inspects a JSON example and emits an F# record type. It walks the value tree once — every nested object becomes its own type, and the parent references it by name. Field names are converted from JSON’s camelCase or snake_case into the idiomatic style for F#.
Type inference rules
- Strings stay as the language’s native string type.
- Numbers are split into integers vs. floats by checking whether the JS value
Number.isInteger. - Booleans become the language’s native boolean.
- Arrays use the first element’s type. Empty arrays fall back to a generic placeholder.
- Nested objects become a separate generated type, referenced by name.
- Nulls are mapped to the closest "maybe / optional / any" equivalent.
Limits
- One-way only. This generator does not produce parsing or serialization code — just the type definitions.
- Inferred from your sample. If a field is optional, include it in the example; otherwise the generator can’t see it.
- Heterogeneous arrays (different types per element) are not detected — only the first element’s type is used.