Cross-browser JSON Serialization in JavaScript

This JavaScript code implements JSON.stringify and JSON.parse functionality for browsers without native support.

JavaScript object: obj1

The following object is defined in JavaScript:

var obj1 = {
	b1: true,
	s1: "text string",
	n1: 12345,
	n2: null,
	n3: undefined,
	a1: [ 1,1,2,3,5,8, [13, 21, 34] ],
	o1: {
		a: [3, 2, 1],
		b: {
			c: 42,
			d: [ 3.14, 1.618 ]

Selection of properties from obj1:


JSON Serialization of obj1:


Selection of properties following JSON parsing to obj2:



This JavaScript code has been created by Craig Buckler of for Please refer to the article Cross-browser JSON Serialization for JavaScript.

View json-serialization.js for implementation instructions.

Please use the code as you wish at your own risk. It is provided as-is without warrranty of any kind.