本帖最后由 bihex 于 2015-2-13 05:04 编辑
又可以运行了真奇怪,下面的代码为啥只能提取数字,字符串都无法提取;~ #AutoIt3Wrapper_UseX64=n
$json= '"data" : {"info" : [{ "age" : 30,"birth" : 19851020, "name" : "张三", "pic" : "http://...namepic.jpg","weight" : 68.5 }]}, "ok" : true'
MsgBox(4096, "", $json&@CRLF)
$oMSSC = ObjCreate('ScriptControl')
$oMSSC.Language = 'JavaScript'
$oMSSC.AddCode('var ParseJson = {' & $json & '};')
$age = $oMSSC.Eval('ParseJson.data.info[0].age');age
$birth = $oMSSC.Eval('ParseJson.data.info[0].birth');birth
$name=$oMSSC.Eval('ParseJson.data.info[0].name');name
$weight=$oMSSC.Eval('ParseJson.data.info[0].weight');weight
$pic=$oMSSC.Eval('ParseJson.data.info[0].pic');pic
MsgBox(4096,'' ,'age:'& $age&@CRLF&'birth:'& $birth&@CRLF&'name:'& $name&@CRLF& 'weight:'& $weight&@CRLF&'pic:'& $pic)
|