我是用minuui做界面, $.ajax({ url : “/config2”, dataType: ‘json’, cache: false, type : “post”, data : { type:“show”, version:version, channel:channel }, success : function(result) { } 然后 result是一个json数据,但是目前在textarea里面显示为字符串,怎么显示json格式的数据?
什么是 json 格式的数据?
好吧 可能我表达不是太准确,这样的数据 { “1”: { “type”: “1”, “switch”: “1”, “startTime”: “1405405793”, “endTime”: “1405664993”, “signDays”: “3”, “awardCoin”: “100000”, “desc”: “desc” }, “2”: { “type”: “2”, “switch”: “1”, “startTime”: “0”, “endTime”: “0”, “dropRate”: “20”, “dropNumRate”: "20“ }, }
现在网页中显示是这样的
{“1”:{“type”:“1”,“switch”:“1”,“startTime”:“1405405793”,“endTime”:“1405664993”,“signDays”:“3”,“awardCoin”:“100000”,“desc”:“desc”},“2”:{“type”:“2”,“switch”:“1”,“startTime”:“0”,“endTime”:“0”,“dropRate”:“20”,“dropNumRate”:“20”},“3”:{“type”:“3”,“switch”:“1”,“startTime”:“0”,“endTime”:“0”,“missions”:[{“mission”:“0”},{“mission”:“1|4|3”},{“mission”:“1|2”},{“mission”:“2|4”},{“mission”:“1|3|4”}],“awardGem”:6}}
希望能这样显示: { “1”: { “type”: “1”, “switch”: “1”, “startTime”: “1405405793”, “endTime”: “1405664993”, “signDays”: “3”, “awardCoin”: “100000”, “desc”: “desc” }, “2”: { “type”: “2”, “switch”: “1”, “startTime”: “0”, “endTime”: “0”, “dropRate”: “20”, “dropNumRate”: "20“ }, }
你需要的是json代码格式化…
嗯 对的 或者说可以让这个控件能解析json