Menu

Paste JSON, get Java records: a small IntelliJ plugin for API payloads
📰

Paste JSON, get Java records: a small IntelliJ plugin for API payloads

DEV Community: java·Datawharf Tools·6 days ago
#jb8efOPL
#devtojava#devto#dev#java#record
Reading 0:00
15s threshold

If you write Java against REST APIs, you have typed the same thing many times: copy a JSON response, then hand-write the classes that match it. For years the IntelliJ answer was GsonFormat, which generated old-style POJOs. It stopped working with current IDEs a while ago, and the popular JSON-to-class plugins I checked generate classes, not Java records , which is what you want for an immutable API payload in Java 16+.

So I built a small one: JSON to Java Record , now on the JetBrains Marketplace.

What it does

Copy this JSON:

{ "order_id" : 10452 , "created_at" : "2026-11-08T14:03:00Z" , "total" : 129.95 , "paid" : true , "customer" : { "id" : 88 , "full_name" : "Ana Ruiz" , "email" : "[email protected]" } , "items" : [ { "sku" : "KB-01" , "qty" : 1 , "price" : 89.0 } , { "sku" : "MS-02" , "qty" : 2 , "price" : 20.475 , "gift_wrap" : true } ] }

Enter fullscreen mode

Exit fullscreen mode

Press Alt+Insert in a Java file, choose Paste JSON as Java Record...…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.