Subject: [alto] How strict should we be about JSON syntax?

From: Bill Roome <[email-masked]>
Date: Tue, 12 Jul 2011 10:43:40 -0400

I just discovered an interesting problem with JSON strings. RFC 4627 says
that a string must be enclosed on double quotes. Eg,

	{ "pids": [ "Pid1" ]}

However, the java JSON parser I downloaded from www.json.org --
http://www.json.org/java/index.html -- is more permissive. It allows
single quotes or even no quotes. So that parser accepts the following as
equivalent to the above:

	{ 'pids': [ 'Pid1' ]}
	{ pids: [ Pid1 ]}

This begs the question of whether the ALTO spec, and the interop tests,
should require strict compliance to RFC 4627.

For example, if only a few parsers are as permissive as the one I
downloaded, then we should require strict compliance. On the other hand,
if most parsers are that permissive, then it will be difficult to enforce
compliance.

Suggestions? Particularly from folks who've worked with other JSON
libraries?

BTW, I'd hate to repeat the browser wars of the 90's. At one point, if you
did not close table tags properly, netscape ignored the table. But
explorer was more forgiving, and displayed it. The result was a lot of
people thought netscape was broken.

---

From: Mikio Hara <[email-masked]>
Date: Wed, 13 Jul 2011 17:21:42 +0900

Hi,

> Suggestions? Particularly from folks who've worked with other JSON

I hope ALTO protocol should be strict on JSON syntax during
it refers to RFC 4627 and its descendants.

At present JSON package of the Go language doesn't accept
unquoted/non-quoted JSON string as the JSON value, just
fails parsing.

-- Mikio

---

From: Enrico Marocco <[email-masked]>
Date: Wed, 13 Jul 2011 12:09:55 +0200

> Suggestions? Particularly from folks who've worked with other JSON

I'd suggest to stick to 4627 strictly. The relaxed syntax is a superset
of the strict one and parsers capable of digesting the former (e.g.
JavaScript parsers) are also able to parse the latter, but the opposite
is not necessarily true.

-- 
Ciao,
Enrico