excel-to-json icon indicating copy to clipboard operation
excel-to-json copied to clipboard

Remove opening and closing []

Open honzik20 opened this issue 5 years ago • 5 comments

Is it possible to remove the opening and closing square brackets?

honzik20 avatar Apr 12 '19 18:04 honzik20

Yes, please!

wtfatty avatar Oct 11 '21 13:10 wtfatty

Do you want just one object? In that case you could use a single object sheet.

eproxus avatar Oct 11 '21 16:10 eproxus

My output should be like this:

{
	"Platform1" :
	[
		{
			"Locale" :
			{
				"pt-BR" : "Localization 1",
				"en-US" : "Localization 2"
			},		
			"URL" : "http://someurl.com",
			"Type" : 1
		},
		{
			"Locale" :
			{
				"pt-BR" : "Localization 1",
				"en-US" : "Localization 2"
			},         
			"URL" : "http://someurl.com",
			"Day" : 11,
			"Month" : 10,
			"Year" : 2021,
			"Type" : 2
		}
   ],
	"Platform2" :
	[
		{
			"Locale" :
			{
				"pt-BR" : "Localization 1",
				"en-US" : "Localization 2"
			},          
			"URL" : "http://someurl.com",
			"Type" : 1
		},
		{
			"Locale" :
			{
				"pt-BR" : "Localization 1",
				"en-US" : "Localization 2"
			},        
			"URL" : "http://someurl.com",
			"Day" : 11,
			"Month" : 10,
			"Year" : 2021,
			"Type" : 2
		}
   ]
}

I cannot use single object sheet because I need the others tab to nest the content. Also, do you have any idea on how to achieve

"Platform1" :
	[

wtfatty avatar Oct 11 '21 16:10 wtfatty

I think what you want is currently not possible (unless you can combine the single object sheet and the keyed/list sub properties somehow but I doubt it). Removing the outer brackets would produce invalid JSON so that is also not supported.

eproxus avatar Oct 12 '21 11:10 eproxus

My best advise (because the tool is no longer maintained) is to either fork it and send a pull request with new features, or use an external tool (like jq) to tweak the JSON after it is produced.

eproxus avatar Oct 12 '21 11:10 eproxus