reports is not parseable as JSON via Javascript API
Closed this issue · 1 comments
kelveden commented
Judging from the a11y docs the following should be possible:
var a11y = require('a11y');
a11y("http://www.google.com", function (err, reports) {
JSON.parse(reports);
});
However, this causes an error Unexpected token o
.
Looking at the raw reports string it is not valid JSON - it's missing quotes around field names and also uses single-quotes; i.e.:
{ audit:
[ { elements: '',
heading: 'Audio elements should have controls',
result: 'NA',
severity: 'Warning' },
...]
}
Or am I missing something?
kelveden commented
Doh. After delving into a11y I can see that it doesn't need JSON.parse
at all - it's already an object. Not sure where I got the idea for JSON.parse from as I can't find it in the a11y docs now.
Sigh.