Json-Eclipse-Plugin icon indicating copy to clipboard operation
Json-Eclipse-Plugin copied to clipboard

Extra features/options for the formater

Open AsharLohmar opened this issue 6 years ago • 2 comments

I'd like this features for the formatter (maybe others will too):

  • don't indent/explode nested objects and arrays if they contain only one level For something like: {"a":1,"b":{"x":2,"y":3},"c":[4,5,6]} instead of getting
{
	"a": 1,
	"b": {
		"x": 2,
		"y": 3
	},
	"c": [
		4,
		5,
		6
	]
}

get something like:

{
	"a": 1,
	"b": { "x": 2, "y": 3 },
	"c": [ 4, 5, 6 ]
}
  • don't indent more than n'th level Es. {"a":{"b":{"x":2,"y":3,"c":[4,5,6]}}} , for n = 2 would give:
{
	"a": {
		"b": { "x": 2, "y": 3, "c": [ 4, 5, 6]}
	}
}

AsharLohmar avatar Apr 16 '18 20:04 AsharLohmar

Interesting idea! I will put it on my TODO list. If you want to have it soon, please free to implement and submit your code.

msteiger avatar Apr 23 '18 18:04 msteiger

I'm a little too "rusty" with Java, I'm a python guy now. But I could give it a try, sounds like an interesting challenge.

AsharLohmar avatar Apr 23 '18 20:04 AsharLohmar