function app(str) { var json = JSON.parse(str, function(k, v) { if (k === '') return v; if (typeof v === 'number') return v * 2; return v; }); document.body.innerText = JSON.stringify(json, null, 2); } var obj = { xian: { huawei: 200, apple: 10 }, beijing: { huawei: 300, apple: 50 }, title: 'hello' }; app(JSON.stringify(obj));