<script type="text/javascript">
function JsonToStr(o) {
var r = [];
if (typeof o == "string" || o == null) {
return o;
}
if (typeof o == "object") {
if (!o.sort) {
r[0] = "{"
for (var i in o) {
r[r.length] = i;
r[r.length] = ":";
r[r.length] = JsonToStr(o[i]);
r[r.length] = ",";
}
r[r.length - 1] = "}"
} else {
r[0] = "["
for (var i = 0; i < o.length; i++) {
r[r.length] = JsonToStr(o[i]);
r[r.length] = ",";
}
r[r.length - 1] = "]"
}
return r.join("");
}
return o.toString();
}
window.onload = function () {
var str = '{ "people": [{ "firstName": "Brett", "lastName":"McLaughlin", "email": "aaaa" },{ "firstName": "Jason", "lastName":"Hunter", "email": "bbbb"},{ "firstName": "Elliotte", "lastName":"Harold", "email": "cccc" }]} ';
alert(JsonToStr( eval('('+str+')')));
// alert(eval(str));
//alert(JsonToStr(str));
}
</script>