Skip to content

JSONTestSuite test results #49

@l1bbcsg

Description

@l1bbcsg

There's this Parsing JSON is a Minefield article which details various issues (mostly in edge cases) across different JSON parsers.

Its author produced a test suit to test various implementations. I've run this test suit against Clarinet (on node 9.6.1), results compared to native JSON.parse are below (successful tests not shown).

Generally, I think the results are good with Clarinet being pretty close to native implementation and never failing too hard. But there are two things it still does wrong: It does not fail on some wrong inputs and fails on legitimate results consisting of one literal (i.e. null). The former is pretty minor I think, while the latter may lead to compatibility issues.

I'm raising this issue more for the purposes of discussion. What do you think, should those be addressed?

Results screenshot

image

Legend

image

Snippet I used to run Clarinet (derived from their JSON.parse):

var fs = require('fs');
var path = process.argv[2];
var clarinet = require('clarinet');
var parser = clarinet.parser();

try {
	var data = fs.readFileSync(path, 'utf-8');

	parser.onerror = function(e) {
		throw e;
	}
	parser.write(data).close();
	
} catch (e) {
	console.log("--", e.message)
	process.exit(1);
}

process.exit(0);

Note that at the time of writing the test runner has a really weird bug preventing it from running which isn't hard to patch out though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions