1. 程式人生 > >Html的字典和json轉換

Html的字典和json轉換

如字典:

dDeviceInfo : {
"Android_Os_Version" : "7.0",
"Resolution" : "1193 × 720",
"AvailMem" : "336.0MB",
"IsWife" : "True",
"Phone_Model" : "LG-TP260",
"CPUModel" : "0 "

}

把 DeviceInfo 轉換為字串顯示

JSON.stringify( dDeviceInfo ) 就可以轉換為字串顯示,不再是一個object(試過可行:http://www.runoob.com/json/json-stringify.html)

JSON.parse() 應該就是把字串解析為字典(沒試過:http://www.runoob.com/json/json-parse.html)