Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It allows trailing commas, and claims IE6 compatibility. I don't understand how both can be true.

  In Internet Explorer 6 and 7, there is an easy to introduce
  javascript bug relating to commas. If, when defining an 
  array or an object, you leave a trailing comma after the 
  last item in your collection, IE will fail to parse your 
  javascript file:

    var x = [1,2,3,]; //ERROR
    var y = {'a': 1, 'b': 2, 'c': 3,}; //ERROR


They wrote a custom parser that works in all browsers -- it doesn't use eval. JSON5 is a subset of ES5, not a subset of JavaScript that runs in all browsers. Notice that it also allows reserved words as keys -- an ES5 feature that doesn't work even in IE8.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: