Preserve JSON Arrays

Oxygen general issues.
jfill
Posts: 2
Joined: Thu Dec 08, 2011 9:06 pm

Preserve JSON Arrays

Post by jfill »

I have manually created a JSON file but when I open the file up with oxygen and edit it then re-save it converts all array elements with only child element to non array. Take this for example.

{"pages": [{"id": 1}]}

when saved in grid mode will change to

{"pages": {"id": 1}}

This is troublesome b/c it is recreating the structure of the json document which is NOT desired. Is there a way to avoid this?

Thanks in advance.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Preserve JSON Arrays

Post by Radu »

Hi Jason,

You are right in the description of the behavior.
In order to display the JSON in the Grid page we convert it to XML and some of the JSON structure information is lost in this way.
We'll try to add some metadata information and remove this unwanted behavior.
I'll update this thread when the issue gets implemented, hopefully we can fix it before Oxygen 13.2 which will appear in January next year.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jfill
Posts: 2
Joined: Thu Dec 08, 2011 9:06 pm

Re: Preserve JSON Arrays

Post by jfill »

Radu,

That would be outstanding! We of course have a standard for parsing our files in our application so if the structure is changed our parser breaks. For now what I have done is just add an extraneous element so it forces an array b/c it has 2 elements. Then we just do a check in the parser to see if the last element in the array is invalid, if so just omit it. At least this way we can proceed with the product.

If this gets in the next version that would be great as we are currently on a trial and would like to move forward with a purchase but this would prohibit the purchase since we do not want to always deal with a work around.

Thanks for your timely reply.

Jason
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Preserve JSON Arrays

Post by Radu »

Hi Jason,

I can confirm that in Oxygen 13.2 (in January next year) this issue will be fixed.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply