image Image
Convert Image Image to Base64 Converter
descriptionText
Compare textText to Hex Text to Base64 Word CounterCase ConverterVietnamese Accent Remover & Slug GeneratorRegex Tester
Json
Json to Excel/Csv JSON ⇄ YAML ConverterJSON to TypeScript, C# & Go
table_chartExcel
Excel/Csv to Json Excel/Csv to Sql Excel/Csv to Html
scheduleTime
Convert datetime Timezone Info
Url
Encode and Decode URLs Shorten URL
smart_displayVideo
Download Youtube
Sql
Statistics Parser Statistics Compare
SEO
Create Sitemap
listFormatter
Json FormatterXML FormatterCSS FormatterHtml FormatterJs FormatterSql FormatterException Formatter
listOther
Convert TokenConvert HashColor PickerGenerate PasswordQR Code GeneratorQR Code ScannerVietQR Bank Transfer QR GeneratorUUID / ULID / NanoID GeneratorNumber Base Converter
searchSearch
Search tools
codeTracer
C# Tracer Formatter
help_outlineAbout
About UsPrivacy PolicyTerms of Service
THUTOOL
other tool Exception Formatter keyboard_double_arrow_right UUID / ULID / NanoID Generator keyboard_double_arrow_right Compare text keyboard_double_arrow_right

JSON to TypeScript, C# & Go

🔒 Processed 100% in your browser – your data never leaves your device

How to generate TypeScript, C# or Go types from JSON

Turn a JSON sample, such as an API response, into ready-to-use type definitions. The generator runs entirely in your browser, so your data never leaves your device.

  1. Paste your JSON into the JSON input box. The code is regenerated as you type.
  2. Choose the target: TypeScript interface, TypeScript type, C# class or Go struct.
  3. Optionally change the Root name (default Root).
  4. Copy the result or download it as a .ts, .cs or .go file.

How types are inferred

  • Each nested object becomes its own named type, named after its key in PascalCase. Array items use a singular name, so items becomes Item.
  • All objects in an array are merged. A key that is missing in some elements becomes optional: ? in TypeScript, nullable in C#, a pointer with omitempty in Go.
  • Numbers become number in TypeScript, int, long or double in C#, and int64 or float64 in Go, based on the values.
  • Mixed arrays become a union in TypeScript, object in C# and interface{} in Go. A value that is only ever null becomes any.
  • Keys that are not valid identifiers are quoted in TypeScript, mapped with [JsonPropertyName] in C#, and Go structs always get json tags.
  • Identical nested types are reused; different types with the same name get a number suffix.

FAQ

Why give several samples? Put multiple objects in an array to let the tool detect optional and nullable fields more accurately.

Is my JSON uploaded? No. Everything is processed locally in your browser.

Related tools

  • Json to Excel/CsvConvert JSON to Excel (XLSX) or CSV online for free. Paste or upload JSON and download a ready-to-use spreadsheet in seconds.
  • JSON ⇄ YAML ConverterFree online JSON to YAML and YAML to JSON converter. Choose indent, pretty or minified output, see syntax errors by line. Runs 100% in your browser.
  • Encode and Decode URLsURL encode or decode any string online (percent-encoding). Free, instant and processed entirely in your browser.
  • Download YoutubeGet direct download links for YouTube videos in the best available qualities (1080p, 720p, 480p). Paste a link and choose a stream.
  • Statistics ParserParse SQL Server SET STATISTICS IO and TIME output into readable tables with totals for logical reads, CPU and elapsed time.
  • Create SitemapEffortlessly create a sitemap for your website by crawling and capturing all URLs with our powerful online sitemap generator. Our tool will crawl through your website, collecting all accessible URLs, and generate a comprehensive sitemap file for easy submission to search engines. With our user-friendly interface and efficient crawling process, you can quickly create a sitemap that ensures better indexing and visibility for your website. Start using our sitemap generator now and improve your website's search engine optimization (SEO) and overall online presence.
@Made by THUTOOL