Reputation: 367
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?
Upvotes: 29
Views: 40001
Reputation: 12948
You can use inject language feature.
Ex:
String myJsonString = "";
Refer official documentation for more info.
Upvotes: 87
Reputation: 9786
For anyone that is using STS (Spring Tool Suite) and generally Eclipse the escape feature can be enabled by checking the checkbox under:
Preferences -> Java -> Editor -> Typing -> Escape text when pasting into a string literal
after this just define a String and paste the json
content and the IDE will take care of the escaping.
Upvotes: 0