Reputation: 15504
I have large JSON file with a lot of empty objects and arrays, but when i format this file in Intellij Idea it adds automatically spaces into all empty objects and arrays.
So, was:
{
"someObject": {},
"someArray": []
}
became:
{
"someObject": { },
"someArray": [ ]
}
and all other lines like this.
Since our team uses different editors/formatters for this file, i can't commit such changes, because this will be "formatting war" with other people on the same project, who use other editors for JSON.
In IDEA Settings->Editor->Code Style->JSON
i found these settings:
but looks like nothing about "empty object/array spaces".
So, the question is: is it possible to change default empty object/array formatting in JSON for Intellij IDEA? May be i can patch some formatter plugin or install other one for JSON?
Upvotes: 1
Views: 2329
Reputation: 15518
As per the comment above, your settings look fine and I can confirm that on my local 14.1.7 installation they work as expected.
but looks like nothing about "empty object/array spaces"
The settings which you are showing, Editor -> Code Style -> JSON -> Spaces tab
are what your looking for:
Braces
checkbox handles objectsBrackets
checkbox handles arraysYou can add an empty object/array in the preview section on the right, and try to check/uncheck again those 2 checkboxes to see what happens:
Upvotes: 3