IDEA makes the code in the .json
file easier to read by adding appropriate line breaks and indentation, but I now want to ask IDEA to compress the JSON content to the extreme (without any indentation and line breaks). What should I do?
With IntelliJ IDEA 2021.2.1 (Ultimate Edition) at least, you can simply do:
Select-All, Edit > Join Lines
(Windows: ctrl-A, ctrl-shift-J with default mapping.) This places everyting on one line, so no indentation or linebreaks. However, there will be a after commas and before/after colons, if your code style is set for that.
IDEA doesn't have any built-in plugins for that. You can try the solutions available on the web, json-minify package, for example. It can then be set up as external tool or a file watcher to be run from the IDE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With