JSONNumber - optional decimal

Garrett Smith dhtmlkitchen at gmail.com
Tue Jun 15 14:36:03 PDT 2010

On 6/10/10, Sigbjorn Finne <sigbjorn.finne at gmail.com> wrote:
> Hi Garrett,
> On 6/9/2010 05:46, Garrett Smith wrote:
>> ...
>> IF anyone has a correct JSON parser, I would appreciate it. Also, are
>> there any good test suites for JSON?
> http://testsuites.opera.com/JSON/  is one. Hallvord Steen has a good
> blog post on it,
> http://my.opera.com/core/blog/2009/12/18/native-json-support-in-opera
> Predates Carakan by a couple of weeks, so the Opera perf numbers are a
> bit dated by now.
> hth

It would be really useful to have the test as a zip file so it could
be downloaded and run locally.

I've identified five bugs in json2.js' JSON.parse and I want to
address those. I suspect more could be found with a test suite for
JSON.parse (no reviver).

The Opera test functions start running automatically. It would be nice
to have a start button and placed next to that a warning that the test
may freeze or crash internet explorer 8 (as it happened to me).

With a start button, I would at least have the hacking ability to say,
for example, type into the location bar: javascript:
addMyJSONScript(); void (JSON.parse = MyJSON.parse) and then hit
enter, and then hit the start button on the test runner. That kind of
sucks, though. Really what I want is a testsuite that I can download
and run.

I've also noticed that the test runner uses sync request. This can be
a problem if the test fails to load. Instead, it should use async
requests or iframes or something -- so long as it is not known to lock
up the browser. Perhaps that is what caused the freeze in IE (or was
it the performance test that was too intensive?)

Also, I noticed in the blog entry:

| TAB characters may not appear inside strings
| - {"tab":"there is a tab -> <- here"} is wrong!
| The spec requires using \t instead of a literal TAB character.

The blog entry goes on about on how TAB character is not allowed in
strings. Where in the spec is it stated that literal TAB characters in
strings are disallowed?


Finally, I'd like mention the buggy implementations that have been
released: Firefox and IE. Having to devise feature tests for every
known implementation failure case requires the developer first gather
known failures. He must do this by testing all the implementations
that he can, and, for each found failure, provide a feature test in
the adapter script he is writing and where that feature test fails,
provide a fallback to his own implementation.That's a lot of burden on
the developer.

Instead, I'd much rather see open test suites where implementations
would collaborate and release consistent, standard features.


More information about the es-discuss mailing list