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…


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:

Speaking of the JSON specifically, there is a feature request to “compact” JSON's back in a single line:

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:


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


Please sign in to leave a comment.