<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<pre id="pre-id"></pre>
<script type="text/javascript">
var worker = [{
id: 2,
name: "Axel",
salary: 13980
}, {
id: 3,
name: "Rory",
salary: 1200
}, {
id: 4,
name: "Cleo",
salary: 14890
}];
// JSON.stringify = function(value, replacer, space) { return ""; }
/**
* @param {Object} value The value to convert to a JSON string
* @param {Function} replacer If a function, transforms values and properties encountered
while stringifying; if an array, specifies the set of properties
included in objects in the final string
* @param {Number|String} space Causes the resulting string to be pretty-printed
* @returns {String}
*/
document.getElementById('pre-id').innerHTML = JSON.stringify(worker, null, 2);
/*
run:
[
{
"id": 2,
"name": "Axel",
"salary": 13980
},
{
"id": 3,
"name": "Rory",
"salary": 1200
},
{
"id": 4,
"name": "Cleo",
"salary": 14890
}
]
*/
</script>
</body>
</html>