This commit is contained in:
Douglas Crockford 2019-08-26 15:15:55 -07:00
parent aef828bfcd
commit 594c8fa5f8
2 changed files with 2 additions and 42 deletions

8
README
View file

@ -4,19 +4,15 @@ JSON in JavaScript
Douglas Crockford
douglas@crockford.com
2019-05-28
2019-08-25
JSON is a light-weight, language independent, data interchange format.
See http://www.JSON.org/
The files in this collection implement JSON encoders/decoders in JavaScript.
JSON became a built-in feature of JavaScript when the ECMAScript Programming
Language Standard - Fifth Edition was adopted by the ECMA General Assembly
in December 2009. Most of the files in this collection are for applications
that are expected to run in obsolete web browsers. For most purposes, json2.js
is the best choice.
in December 2009.
json2.js: This file creates a JSON property in the global object, if there

View file

@ -1,36 +0,0 @@
<html><body><script src="cycle.js"></script>
<pre><p id=output></p>
<script>
function out(s) {
document.getElementById('output').innerHTML += s + '<br>';
}
function doTest() {
var i, o, s, jsonObj;
try {
o = {
number: 98.6,
string: 'Why is it called string?'
};
o.object = o;
o.array = [o];
out(JSON.stringify(JSON.decycle(
[o, o],
function (value) {
if (typeof value === 'string') {
return 'because';
} else {
return value;
}
}
)));
} catch (e) {
debugger;
out(" name: " + e.name);
out(" message: " + e.message);
}
}
doTest();
</script></pre></body></html>