javascript中字符串转化为json对象 var str = '{host:"localhost",sourceDir:"d:\\temp"}'; var jsonstr = eval('('+str+')'); alert(jsonstr.host);//localhost