Json Strings intellij format?

I am developing Java using the idea of โ€‹โ€‹intellij. And I want to assign a json-like format for Java String. But I'm tired of the squadrons I have to deal with.

Is there a simple formatting tool without escape characters?

+6
source share
1 answer

You can use embed language .

Example:

String myJsonString = ""; 
  • Place the cursor between "and".
  • Alt + Enter -> Insert language or link -> select json from the drop-down list,
  • Now you have entered json on this line. Again Alt + Enter -> Edit Json Snippet.
  • Now you can give your json inside the popup tool like regular json, Intellij will convert it as String with escape characters for you. :))

enter image description here

See more details.

+17
source

Source: https://habr.com/ru/post/1011692/


All Articles