Convert JSON to Code

Generate strongly-typed classes in your favorite language without the data leaving your browser

Paste a JSON document and get idiomatic, strongly-typed model code back in Java, Python, Go, C++, C#, Rust, Kotlin, VB.NET, Ruby, TypeScript, PHP, Swift, Dart, or Scala. Types are inferred from the values in your data, nested objects become their own named types, and arrays of objects are widened so a single shape fits every element. Everything runs in your browser: your JSON is never uploaded, and there is no account to create. The same site also formats JSON and converts it to and from YAML, TOML and XML, with the same privacy.

Frequently asked questions

Which languages are supported?

Java (Lombok POJOs and Records), Python (dataclasses), Go (structs with encoding/json tags), C++ (classes with nlohmann::json bindings), C# (classes or records for System.Text.Json or Newtonsoft.Json), Rust (serde structs), Kotlin (data classes for kotlinx.serialization, Jackson, or Gson), VB.NET (classes for System.Text.Json or Newtonsoft.Json), Ruby (Struct, Data.define or plain classes with from_h and to_h), TypeScript (interfaces, type aliases, classes or Zod schemas), PHP (classes or readonly DTOs with fromArray and JsonSerializable), Swift (Codable structs or classes), Dart (classes with fromJson and toJson, or json_serializable models), and Scala (case classes with circe, play-json, or upickle codecs).

Can it convert JSON to YAML, TOML or XML, or format JSON?

Yes. Besides generating code, the site has a JSON Formatter (pretty print or minify without changing any value) and converters that go both ways between JSON and YAML, TOML or XML: JSON to YAML and YAML to JSON, JSON to TOML and TOML to JSON, and JSON to XML and XML to JSON. They run in your browser too, so nothing is uploaded.

Is my JSON uploaded anywhere?

No. Parsing, type inference, and code generation all run in your browser using JavaScript. Your JSON is never sent to a remote server, and there is no account to create. The page keeps your last input and settings in your own browser (localStorage) so they survive a reload; nothing is stored anywhere else.

Is it safe to paste confidential JSON, such as API responses or customer data?

The conversion itself never transmits your JSON, so a confidential payload does not leave your machine. You can verify this: open your browser DevTools, switch to the Network tab, and convert something — no request carries your data. Two things to know: your last input is saved in your browser's localStorage (clear site data to remove it), and the Copy Link button embeds your JSON in the link, so anyone who opens that link, and the server that receives the request, can see it. Only share such links where you are comfortable with that.

Does it cost anything?

No. The generator is free to use with no sign-up and no usage limits.

How are nested objects handled?

Each nested JSON object becomes its own named type, derived from the key it appeared under. Arrays of objects are widened across every element, so a field that is a whole number in one element and a fraction in another gets a type that holds both.

Other languages

More JSON tools