I want to format the JSON files in my eclipse on save file action, based on number of spaces that i can configure. I tried using JSON Editor Plugin but it gave me null pointer exception on saving.
Then i tried JSON Tools plugin and it worked but it used a tab for formatting the lines. Is there any hack that i can do with plugin jar to configure and change TAB to 4 spaces? Are better json formatter available for eclipse?
Goto Window > Preferences > JSON > JSON Files > Editor. Then under the Formatting section, toggle the "Indent using spaces" radio. You might want to adjust your "indentation size" too, e.g. to 2, 3, or 4 spaces.
JSON Editor Plugin Unfortunately, Eclipse doesn't contain a decent JSON editor by default. This plugin helps you with this shortcoming. With the JSON Editor, you can create and edit JSON files in a developer-friendly way.
Some other extensions adhere to the preference set for the general text editor.
If it doesn't clash with other settings you can try:
General -> Appearance -> Editors -> Text Editors
[x] Insert spaces for tabs
Have you tried Json Tools for Eclipse? It is handy and lightweight Eclipse plugin. I have checked this right now and it works as you want - if there are TABs in a modified JSON file, they are changed to 4 spaces.
You can find it in Marketplace or install it using update site:
https://bitbucket.org/denmiroch/jsontools/src/default/JsonSite/
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