<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="autor" content="Daniel MartÃnez Castillo"/>
<title>converterArrayToJson example</title>
<script type="text/javascript" src="converterArrayToJson.class.js"></script>
<script type="text/javascript">
myArray = new Array();
myArray["one"] = "This";
myArray["two"] = "is";
myArray[3] = "an example";
myArray[4] = "of mixed array";
myArray["five"] = {
fiveVar : "foo",
fiveVar2: 700
};
var myVar = new converterArrayToJson(myArray);
</script>
</head>
<body>
<h4>This is an example of converterArrayToJson class.</h4>
<p>
You can contact me at <a href="mailto:danimartcas@hotmail.com">danimartcas@hotmail.com</a>
</p>
<br />
<h4>Thank you for download it!</h4>
<h3>An mixed array :</h3>
<pre>
myArray = new Array();
myArray["one"] = "This";
myArray["two"] = "is";
myArray[3] = "an example";
myArray[4] = "of mixed array";
myArray["five"] = {
fiveVar : "foo",
fiveVar2: 700
};
</pre>
<h4>Outputs: </h4>
<p>
<pre>
{
"one": "This",
"two": "is",
"3": "an example",
"4": "of mixed array",
"five": [
{
"fiveVar": "foo",
"fiveVar2": 700
}
]
}
</pre>
<script type="text/javascript">
document.write(myVar.getJson());
</script>
</p>
<!-- Output
{
"one": "This",
"two": "is",
"3": "an example",
"4": "of mixed array",
"five": [
{
"fiveVar": "foo",
"fiveVar2": 700
}
]
}-->
</body>
</html>
|