So, something like that you may have to build out yourself. However, I found that this question has been asked before. And it's been recommend to use the following resource:
http://www.jsonschema2pojo.org/
or go through the headache and build out this feature. Original: Generate Java class from JSON?
Answer from TheoNeUpKID on Stack OverflowVideos
EDIT: as noted in the comments, this is not perfect, as for some variables you will get a "stackoverflow" response
As suggested by @Mr Han's answer, here's how you can do this:
Add a new way to view objects in IntelliJ debugger as JSON by:
- Going to File > Settings > Build, Execution, Deployment > Debugger > Data Views > Java Type Renderers
- Click + to add new renderer
- Call it JSON renderer
- Supply
java.lang.Objectfor Apply renderer to objects of type - Choose Use following expression and supply an expression like:
If you have Gson dependency in the classpath:
if (null == this || this instanceof String)
return this;
new com.google.gson.GsonBuilder().setPrettyPrinting().create().toJson(this);
or if you have Jackson dependency in classpath:
if (null == this || this instanceof String)
return this;
new com.fasterxml.jackson.databind.ObjectMapper().registerModule(new com.fasterxml.jackson.datatype.jsr310.JavaTimeModule()) .disable(com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS).writerWithDefaultPrettyPrinter() .writeValueAsString(this);
- Click OK
- Now when you choose Copy Value on a variable, it will copy as JSON.

Note: If you don't want to change the default behavior, create a "default" renderer also with "use default renderer" settings, and put it first in the list, it will use that as default and you can switch to JSON on demand by right click on debugged variable -> use renderer: JSON Renderer.
Alternatively, as seen here, you can use the following piece of code in your debug watcher:
new ObjectMapper()
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
.writerWithDefaultPrettyPrinter()
.writeValueAsString( myObject )