Logo
doctype [?]
[strict] [loose] [none]

Data Dumper


Reference Object

For the examples below, the example object is constructed as follows:

<script type="text/javascript">
var obj = new Object();
obj["stringValue"] = "mystring";
obj["numberValue"] = 123;
obj["booleanValue"] = false;
obj["nullValue"] = null;
obj["functionValue"] = function dummy() { };
obj["domobject"] = new Option('test','test',false,false);
obj["nestedStructures"] = new Object();
obj['self'] = obj;
obj["nestedStructures"]["subObject"] = new Object();
obj["nestedStructures"]["subObject"]["subArray"] = new Array("one",2,false,new Object(),new Array());
obj["nestedStructures"]["subObject2"] = new Object();
obj["nestedStructures"]["subObject2"]["subArray"] = new Array();
</script>

setMaxIterations()

These examples show how setting the max iterations will limit the total number of properties traversed.

Code
Dumper.setMaxIterations(3);
Dumper.write(obj);
Output
Code
Dumper.setMaxIterations(7);
Dumper.write(obj);
Output

setMaxDepth()

These examples show how setting the max depth will limit how deeply into the object it is traversed.

Code
Dumper.setMaxDepth(1);
Dumper.write(obj);
Output
Code
Dumper.setMaxDepth(2);
Dumper.write(obj);
Output
Code
Dumper.setMaxDepth(3);
Dumper.write(obj);
Output

Traversing Specified Properties

This example shows how to traverse only through specific properties of the top-level object.

Code
Dumper.write(obj,'domobject','numberValue');
Output