By garethr
Thursday, 6. December 2007, 15:19:07
JSON Configuration for JavaScript
If you're working in a web development team with developers alongside designers, and you want to give the designers an easy way to change the variable parts of the application without the risk of breaking things, an external configuration file is a great idea, and JSON (JavaScript Object Notation) is a perfect format in which to store this data. In this article, Gareth Rushgrove shows you how.
( Read the article )
By hallvors
Saturday, 8. December 2007, 10:18:24

Small nit: "class" is a reserved word in ES, I'm not sure if any UA would actually throw an error on "Object.array[0].class" but I think it shouldn't be used like this in demo/tutorial code.
By v1c
Thursday, 22. May 2008, 15:10:34

Opera 9.27 for Windows International (latest available) cannot load JSON script json2.js (taken from
http://www.JSON.org/json2.js):Inline script compilation
Syntax error while loading: line 181 of linked script at file://localhost/C:/TMP/json2.js :
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17
------------------^
Other browsers (IE, FF) are working with this script library without errors. Minimal HTML page with script causing problem is:
<html>
<head>
<script type="text/javascript">
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
</script>
</head>
<body>
</body>
</html>
When I make shorter regular expression, all works fine (for example, var cx=/[\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; is OK).
Bug report is unavailable... Have someone tested this with earlier (or latest 9.5 beta) versions of Opera?
By kskander
Tuesday, 1. July 2008, 15:05:18

It seems like Opera stumbles on the 'raw' regular expression syntax.
I replaced the troublesome lines in json2.js below:
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapeable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap,
with:
var cx = new RegExp('/[\\u0000\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g');
var escapeable = new RegExp('/[\\\\\\"\\x00-\\x1f\\x7f-\\x9f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g');
var gap,
[...]
Seems to work on FF/IE/Opera so far.
Cheers.