object to string var data = {"id":1, "name":"tiger"}; var str = JSON.stringify(data); 2个空格缩进 JSON.stringify(data, null, 2) ; string to object function toObj (str){ return eval('(' + str + ')'); }