Format Json Strings intellij?

intellij-idea, java, json

Solution

You can use inject language feature.

Ex:

String myJsonString = "";

- Place cursor between " and ".

- Alt + Enter -> Inject language or reference -> select json from the dropdown appears,

- Now you have injected json to that String. Again Alt + Enter -> Edit Json Fragment.

- Now you can give your json inside pop-up tool as a normal json, Intellij will convert it as a String with escape characters for you. :))

Refer official documentation for more info.

Problem

I am developing Java using intellij idea. And I want to assign a json like format to a Java String. But I am tired with escape characters that I have to deal with. Is there any easy tool to format without escape characters?

Original source

Related problems