How to unprettify JSON file in phpstorm?

I often find myself editing complex json files that are often not formatted (everything is one big sinle line of text). So to simplify that I execute Reformat Code action in phpstorm. The things is after editing I would like to put the content back into unformatted state. Is there something like that available in IDE or at least some community plugin? I find it silly to have to go to random site to do that…

0
2 comments

I am afraid it is not possible to revert formatting to the “before” state without reverting other code changes. There was a similar request years ago but is still shelved:
https://youtrack.jetbrains.com/issue/IDEA-140721/Format-code-just-for-reading-in-unmodified-files

Speaking of the JSON specifically, there is a feature request to “compact” JSON's back in a single line:
https://youtrack.jetbrains.com/issue/WEB-31875/Compact-action-for-JSON-editor

As a kind of workaround you may want to use Structure View. At least, it should help you to navigate thru your unformatted JSON files structure:

0

It is a shame this feature has not been implemented yet. Structured view can help with reading but still not the same.

0

Please sign in to leave a comment.