CraftTools

JSON to DTO Generator

Guide: Turn JSON or XML Into Classes (DTOs) in Java, C# and More

3 classes

Nothing you enter or choose here leaves your device. This tool runs in your browser.

How to use

  1. 1Paste a JSON object, or a list of objects, into the input box.
  2. 2Choose the language and, if you like, a root class name and package.
  3. 3Pick a style and turn annotations on or off.
  4. 4Click Copy code and paste it into your project.

Frequently asked questions

What is a DTO?

A data transfer object is a simple class that holds the fields of a request or response, such as an API result, so you can use it as typed data in your code.

How are types and nested objects handled?

Every nested object becomes its own class, lists become List or array types, and numbers become int, long or double depending on the values. Fields that are missing from some objects in a list are marked optional, and fields that are null become nullable.

Why does 10.0 become an integer?

JSON doesn't tell integers and decimals apart, and 10.0 is read as the number 10. If a field can be fractional, include a value like 10.5 in your sample, or change the type by hand.

Is my JSON uploaded anywhere?

No. The classes are generated in your browser, so private API responses stay on your device.

Read the guide

Learn how this works and how to get the most from it.

Developer

Turn JSON or XML Into Classes (DTOs) in Java, C# and More

What a DTO is, how generated classes map JSON and XML, and the details to check before you trust a generated model.

1 min read

XML to DTO Generator

Turn XML into Java (JAXB), C#, TypeScript, Kotlin, Python or Go classes.

JSON Formatter & Validator

Prettify, minify and validate JSON, with error line numbers.

Text Diff Checker

Compare two texts side by side and see exactly what changed.

Base64 & URL Encoder / Decoder

Encode and decode Base64 and URL-encoded text instantly.