JSON Validator not accepting top level arrays.

Oxygen general issues.
jannylun
Posts: 16
Joined: Wed May 20, 2009 2:25 pm

JSON Validator not accepting top level arrays.

Post by jannylun »

Moi!

The built-in JSON Validator does not consider top level arrays as valid JSON. Top level arrays may not be the preferred solution, but I believe they are valid JSON. Please check the behavior of the validator.

Br,
Jan
Radu
Posts: 9445
Joined: Fri Jul 09, 2004 5:18 pm

Re: JSON Validator not accepting top level arrays.

Post by Radu »

Hi Jan,

Can you give me a small example of JSON code that the editor considers as invalid?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jannylun
Posts: 16
Joined: Wed May 20, 2009 2:25 pm

Re: JSON Validator not accepting top level arrays.

Post by jannylun »

Hello Radu!

For example:

Code: Select all

[
{
"color": "red",
"value": "#f00"
},
{
"color": "green",
"value": "#0f0"
}
]
or

Code: Select all

[ 100, 500, 300, 200, 400 ]
Gives error:

Code: Select all

E [JSON Validator] A JSONObject text must begin with '{'
These are valid according to for example jsonlint.com.

Another thing is that oxygen approves strings that are not wrapped in quotes, so this is considered valid in oxygen:

Code: Select all

{
color: "red",
value: "#f00"
}
While jsonlint.com says:

Code: Select all

 Parse error on line 1:
{ color: "red", va
-----^
Expecting 'STRING', '}'
//Jan
Radu
Posts: 9445
Joined: Fri Jul 09, 2004 5:18 pm

Re: JSON Validator not accepting top level arrays.

Post by Radu »

Hi Jan,

You're right in both cases, I registered both issues to our internal bugs list and I'll update this forum post with more details when they are implemented.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jannylun
Posts: 16
Joined: Wed May 20, 2009 2:25 pm

Re: JSON Validator not accepting top level arrays.

Post by jannylun »

Thanks!
Radu
Posts: 9445
Joined: Fri Jul 09, 2004 5:18 pm

Re: JSON Validator not accepting top level arrays.

Post by Radu »

Hi Jan,

In Oxygen 13.1 (which will be available in a couple of weeks) you will be able to validate, format and indent and edit in the Grid page also JSON Arrays.

The other problem (missing quotes to the key not reported as errors) will probably be fixed in a future version.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 9445
Joined: Fri Jul 09, 2004 5:18 pm

Re: JSON Validator not accepting top level arrays.

Post by Radu »

Hi,

Just to update this post, this issue:
The other problem (missing quotes to the key not reported as errors) will probably be fixed in a future version.
was fixed in Oxygen 15.0 which should report it as an error.

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