Turn JSON into Go, TypeScript, PHP or Python types

Type inference that merges across array items, so one null field does not collapse the whole property into any.

How JSON to Struct works

Parsers and formatters run as JavaScript on the source you pasted. That is why a large document can freeze the tab for a moment — the work is genuinely happening here, not on a server. Configuration files and private keys therefore never leave your machine to be formatted.

That is the whole architecture: static files, one script, no upload endpoint to leak or log. Close the tab and the work is gone.

Good to know

  • Works offline once loaded, including on flights and in locked-down networks.
  • No file size limit beyond your device's own memory.
  • Free to use, with no account and no usage counter.
  • Results are produced locally, so they are not logged or shared with anyone.

Questions

How are numbers typed?

Integers become int (or number/float), anything with a decimal becomes float64/number/float. A field that is sometimes 1 and sometimes 1.5 will be typed as the first value seen in the array — check it.

What happens with null values?

A lone null widens the type to interface{}/unknown/mixed, because the sample gives no information about what will arrive later.

Are JSON keys renamed?

No. Go and Python get a sanitised field name plus the original key in the tag or comment, so nothing is silently lost.

Is my JSON sent anywhere?

No — parsing and code generation happen in the page.

Keep going

More developer tools