<html>
<body>
<h1>使用 <em>replacer</em> 函数</h1>
<p>大写 "city" 的值:</p>
<p id="demo"></p>
<script>
var obj = { "name":"Bill", "age":"19", "city":"Seattle"};
var text = JSON.stringify(obj, function (key, value) {
if (key == "city") {
return value.toUpperCase();
} else {
return value;
}
});
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>