my2ls.com

Type a tool name, topic, or path — results update as you type.

Data to Class

JSON to Java — generate Java records from JSON

Paste a JSON object, name the root record, and copy Java 16+ records—no upload, no account.

API responses and config blobs often arrive as JSON, but your Java code wants typed records. This tool sketches Java record definitions that mirror the object shape, including nested objects and lists.

Everything runs in your browser: paste JSON on the left, set a root class name if you like, click Generate, then copy the Java from the right. Invalid JSON or a non-object root shows a clear error instead of silent junk.

JSON to Java workspace

From sample payload to compilable-looking records—without leaving the tab.

JSON input
Java output

What you can do here

From sample payload to compilable-looking records—without leaving the tab.

Emit Java records with fields inferred from strings, numbers, booleans, objects, and arrays.

Nest record types for nested JSON objects; arrays become List types with imports when needed.

Copy the generated source in one click for your IDE or merge request.

Your JSON never leaves the browser—we do not send it to a server to generate Java.

Generation runs when you click Generate, so half-finished edits do not thrash the output.

How to use it

1

Paste a JSON object into the left editor (API sample, fixture, or logged payload).

2

Optionally change the root record name, then click Generate.

3

Review the Java on the right, tweak names if needed, generate again, then Copy.

What to expect

Output targets Java 16+ records and uses Jackson’s fully qualified @JsonProperty only when a JSON key is not a valid Java identifier. Numbers map to Double; empty arrays become List<Object>. Huge documents can slow the tab—trim samples when possible.

Quick sample

Try pasting this object, then click Generate:

{
  "user": {
    "id": 42,
    "name": "Ada",
    "active": true
  },
  "tags": ["dev", "json"]
}

Quick question

Does my JSON get uploaded to generate Java?

No. Generation runs entirely in your browser. The text you paste is not sent to us to produce Java source.