Visualise newlines in long json strings?

We are filling our API docs in Swagger format which is basically a large JSON file.

Sometimes I need to write really much text into some "description" fields. It can contain many lines of text with formatting and other stuff.

JSON requires all line breaks to be escaped as \n. Which results into that all long strings with line breaks display as extremely long single-line string.

Just try to open this json in PHPStorm (WebStorm or other IDE): https://pastebin.com/SUVNbf1m

Look at how ugly it shows up in IDE: https://recordit.co/uBf7ntOuKf

It would be really cool if the IDE could display newlines in JSON as real newlines.

Even simple line-wrapping function would make my life easier but I can't find such setting.

 

Any ideas how to deal with it? Maybe there are some neat plugins for this (I searched but no luck)?

3 comments
Comment actions Permalink

Can't find anything to address this. You can submit this to our tracker at https://youtrack.jetbrains.com/newIssue 

 

0
Comment actions Permalink

@Ilya

What about using a Soft Wraps functionality? Just use Search field in Settings/Preferences to have it enabled by default or all files. Switching it on/off for current file can be done via "View | Active Editor" menu (or gutter context menu).

0
Comment actions Permalink

Andriy Bazanov

Thanks a lot! It works. Enabled "Soft-wrap files" option and added json into the list.

 

Dmitry Tronin

Good note, I'll create a ticket now

0

Please sign in to leave a comment.