找回密码
 加入
搜索
查看: 6222|回复: 4

[效率算法] 请教一下Json问题

[复制链接]
发表于 2013-8-22 19:51:15 | 显示全部楼层 |阅读模式
1,返回字符串问题
例子:{msg:'OK',isok:'1',machine_no:'VS50226125',machine_name:'IdeaCentre B320 G540 2G50GVWHUJ215-7B',litCreateDateLK:'2013-2-20',lblPartEndDateLK:'2016-2-20',TimeSpan1:'1095.00:00:00',TimeSpan2:'146.00:00:00'}
提取machine_name字段时只显示"IdeaCentre"后面的字段无法显示

2.如何提取数组信息
例子:{message:true,driverResult:true,driverList:[{fileSize:'1.64 M',driverVersion:'20090728',OSNameList:'Windows 7 32-bit,Windows 7 64-bit,Windows Vista 32-bit,Windows XP',driverVersionAll:'20090728',PN:18489,partName:'\u952E\u76D8',FileCount:'N',driverName:'Tinian FN Keyboard driver',partId:25,driverId:18489,OSIdList:'1,4,25,26',NotViewDriverId:'',IsNews:'',DriverTips:'',IsNoFile:'',sourceFrom:'2',QHDriverId:'',fileUrl:'http://driverdl.lenovo.com.cn/lenovo/DriverFilesUploadFloder/jiayong//2009102321342869704/Tinian_FN_Keyboard.exe',fileType:'exe',activeTime:'09-10-23'},{fileSize:'1.64 M',driverVersion:'20090728',OSNameList:'Windows 7 32-bit,Windows 7 64-bit',driverVersionAll:'20090728',PN:18736,partName:'\u952E\u76D8',FileCount:'N',driverName:'Tinian FN Keyboard driver for WIN7',partId:25,driverId:18736,OSIdList:'25,26',NotViewDriverId:'',IsNews:'',DriverTips:'',IsNoFile:'',sourceFrom:'2',QHDriverId:'',fileUrl:'http://driverdl.lenovo.com.cn/lenovo/DriverFilesUploadFloder/nonemachine/200911101745571232/Tinian_FN_Keyboard_driver_for_WIN7.exe',fileType:'exe',activeTime:'10-01-08'},{fileSize:'21.39 M',driverVersion:'332.6000....',OSNameList:'Windows 7 32-bit,Windows 7 64-bit',driverVersionAll:'332.6000.4017.65',PN:33323,partName:'\u6444\u50CF\u5934',FileCount:'N',driverName:'Webcam Driver',partId:30,driverId:33323,OSIdList:'25,26',NotViewDriverId:'',IsNews:'',DriverTips:'',IsNoFile:'',sourceFrom:'3',QHDriverId:'',fileUrl:'http://driverdl.lenovo.com.cn/lenovo/DriverFilesUploadFloder/33323/11001006.exe',fileType:'exe',activeTime:'10-12-29'},{fileSize:'115.82 M',driverVersion:'11.8.81.0',OSNameList:'Windows 7 32-bit,Windows 7 64-bit,Windows XP',driverVersionAll:'11.8.81.0',PN:33928,partName:'\u7F51\u5361',FileCount:'N',driverName:'LAN Intel Lewisville 82579V for Win7',partId:36,driverId:33928,OSIdList:'1,25,26',NotViewDriverId:'',IsNews:'',DriverTips:'',IsNoFile:'',sourceFrom:'3',QHDriverId:'',fileUrl:'http://driverdl.lenovo.com.cn/lenovo/DriverFilesUploadFloder/33928/11010061.exe',fileType:'exe',activeTime:'11-04-02'},{fileSize:'26.90 M',driverVersion:'1005.3.91...',OSNameList:'Windows 7 32-bit,Windows 7 64-bit',driverVersionAll:'1005.3.910.2010',PN:34164,partName:'\u65E0\u7EBF\u7F51\u5361',FileCount:'N',driverName:'Realtek Wireless LAN',partId:37,driverId:34164,OSIdList:'25,26',NotViewDriverId:'',IsNews:'',DriverTips:'',IsNoFile:'',sourceFrom:'3',QHDriverId:'',fileUrl:'http://driverdl.lenovo.com.cn/lenovo/DriverFilesUploadFloder/34164/11010025.exe',fileType:'exe',activeTime:'11-05-09'},{fileSize:'9.11 M',driverVersion:'6.1.7600....',OSNameList:'Windows 7 32-bit,Windows 7 64-bit,Windows XP',driverVersionAll:'6.1.7600.63',PN:34309,partName:'\u8BFB\u5361\u5668',FileCount:'N',driverName:'Realtek RTS5209 CardReader Driver',partId:23,driverId:34309,OSIdList:'1,25,26',NotViewDriverId:'',IsNews:'',DriverTips:'',IsNoFile:'',sourceFrom:'3',QHDriverId:'',fileUrl:'http://driverdl.lenovo.com.cn/lenovo/DriverFilesUploadFloder/34309/B3205209.exe',fileType:'exe',activeTime:'11-06-01'},{fileSize:'18.52 M',driverVersion:'1004.2.71...',OSNameList:'Windows 7 32-bit,Windows 7 64-bit',driverVersionAll:'1004.2.716.2010',PN:34628,partName:'\u65E0\u7EBF\u7F51\u5361',FileCount:'N',driverName:'Gemtek RTL8188CE Wireless LAN Driver',partId:37,driverId:34628,OSIdList:'25,26',NotViewDriverId:'',IsNews:'',DriverTips:'',IsNoFile:'',sourceFrom:'3',QHDriverId:'',fileUrl:'http://driverdl.lenovo.com.cn/lenovo/DriverFilesUploadFloder/34628/B3258176.exe',fileType:'exe',activeTime:'11-09-26'},{fileSize:'17.16 M',driverVersion:'3500.3.1.5',OSNameList:'Windows 7 32-bit,Windows 7 64-bit',driverVersionAll:'3500.3.1.5',PN:34755,partName:'\u89E6\u63A7\u677F',FileCount:'N',driverName:'Touch Driver',partId:18,driverId:34755,OSIdList:'25,26',NotViewDriverId:'',IsNews:'',DriverTips:'',IsNoFile:'',sourceFrom:'3',QHDriverId:'',fileUrl:'http://driverdl.lenovo.com.cn/lenovo/DriverFilesUploadFloder/34755/[03]Multi-Touch_Nextwindow 3500_3.1.5.0_WHQL_Win7.zip',fileType:'zip',activeTime:'11-11-15'},{fileSize:'21.40 M',driverVersion:'332.6000....',OSNameList:'Windows 7 32-bit,Windows 7 64-bit',driverVersionAll:'332.6000.4017.84',PN:35468,partName:'\u6444\u50CF\u5934',FileCount:'N',driverName:'Webcam Driver',partId:30,driverId:35468,OSIdList:'25,26',NotViewDriverId:'',IsNews:'',DriverTips:'',IsNoFile:'',sourceFrom:'3',QHDriverId:'',fileUrl:'http://driverdl.lenovo.com.cn/lenovo/DriverFilesUploadFloder/35468/BX40C450.exe',fileType:'exe',activeTime:'12-07-13'},{fileSize:'130.16 M',driverVersion:'6.0.1.6695',OSNameList:'Windows 7 32-bit,Windows 7 64-bit,Windows 8 32-bit,Windows 8 64-bit',driverVersionAll:'6.0.1.6695',PN:36108,partName:'\u58F0\u5361',FileCount:'N',driverName:'Realtek Audio Driver',partId:32,driverId:36108,OSIdList:'25,26,31,32',NotViewDriverId:'',IsNews:'',DriverTips:'',IsNoFile:'',sourceFrom:'3',QHDriverId:'',fileUrl:'http://driverdl.lenovo.com.cn/lenovo/DriverFilesUploadFloder/36108/H1100420.zip',fileType:'zip',activeTime:'12-10-11'},{fileSize:'1.08 M',driverVersion:'5.12.0.13',OSNameList:'Windows 7 32-bit,Windows 7 64-bit',driverVersionAll:'5.12.0.13',PN:36118,partName:'\u4E3B\u677F\u53CA\u82AF\u7247\u7EC4',FileCount:'N',driverName:'AMD Chipset Driver for Win7',partId:43,driverId:36118,OSIdList:'25,26',NotViewDriverId:'',IsNews:'',DriverTips:'',IsNoFile:'',sourceFrom:'3',QHDriverId:'',fileUrl:'http://driverdl.lenovo.com.cn/lenovo/DriverFilesUploadFloder/36118/30000001.exe',fileType:'exe',activeTime:'12-10-12'},{fileSize:'1.43 M',driverVersion:'1.0.0.66',OSNameList:'Windows 7 32-bit,Windows 7 64-bit',driverVersionAll:'1.0.0.66',PN:36124,partName:'USB3.0\u63A7\u5236\u5668',FileCount:'N',driverName:'AMD USB3.0 Driver',partId:67,driverId:36124,OSIdList:'25,26',NotViewDriverId:'',IsNews:'',DriverTips:'',IsNoFile:'',sourceFrom:'3',QHDriverId:'',fileUrl:'http://driverdl.lenovo.com.cn/lenovo/DriverFilesUploadFloder/36124/30000005.exe',fileType:'exe',activeTime:'12-10-12'},{fileSize:'195.60 M',driverVersion:'8.930.0.0',OSNameList:'Windows 7 32-bit,Windows 7 64-bit',driverVersionAll:'8.930.0.0',PN:36234,partName:'\u663E\u5361',FileCount:'N',driverName:'AMD Graphic Driver for Win7',partId:38,driverId:36234,OSIdList:'25,26',NotViewDriverId:'',IsNews:'',DriverTips:'',IsNoFile:'',sourceFrom:'3',QHDriverId:'',fileUrl:'http://driverdl.lenovo.com.cn/lenovo/DriverFilesUploadFloder/36234/VGA_WIN7.exe',fileType:'exe',activeTime:'12-10-18'},{fileSize:'5.62 M',driverVersion:'8.003.073...',OSNameList:'Windows 7 32-bit,Windows 7 64-bit,Windows 8 64-bit',driverVersionAll:'8.003.0730.2012',PN:36271,partName:'\u7F51\u5361',FileCount:'N',driverName:'Realtek RTL8111F LAN Driver',partId:36,driverId:36271,OSIdList:'25,26,32',NotViewDriverId:'',IsNews:'',DriverTips:'',IsNoFile:'',sourceFrom:'3',QHDriverId:'',fileUrl:'http://driverdl.lenovo.com.cn/lenovo/DriverFilesUploadFloder/36271/H1100417.zip',fileType:'zip',activeTime:'12-10-19'},{fileSize:'1.01 M',driverVersion:'2.0.10.262',OSNameList:'Windows 7 32-bit,Windows 7 64-bit,Windows 8 64-bit',driverVersionAll:'2.0.10.262',PN:36458,partName:'\u4E3B\u677F\u53CA\u82AF\u7247\u7EC4',FileCount:'N',driverName:'AMD USB Filter driver for Win 8',partId:43,driverId:36458,OSIdList:'25,26,32',NotViewDriverId:'',IsNews:'',DriverTips:'',IsNoFile:'',sourceFrom:'3',QHDriverId:'',fileUrl:'http://driverdl.lenovo.com.cn/lenovo/DriverFilesUploadFloder/36458/H1100242.zip',fileType:'zip',activeTime:'12-11-09'}],OSResult:true,OSList:[{OSName:'Windows XP',orderNum:1,OSID:'1',isSelect:'false'},{OSName:'Windows Vista 32-bit',orderNum:4,OSID:'4',isSelect:'false'},{OSName:'Windows 7 32-bit',orderNum:2,OSID:'25',isSelect:'true'},{OSName:'Windows 7 64-bit',orderNum:3,OSID:'26',isSelect:'false'},{OSName:'Windows 8 32-bit',orderNum:3,OSID:'31',isSelect:'false'},{OSName:'Windows 8 64-bit',orderNum:3,OSID:'32',isSelect:'false'}],partResult:true,partList:[{orderNum:4,partId:43,partName:'\u4E3B\u677F\u53CA\u82AF\u7247\u7EC4'},{orderNum:8,partId:38,partName:'\u663E\u5361'},{orderNum:9,partId:32,partName:'\u58F0\u5361'},{orderNum:11,partId:36,partName:'\u7F51\u5361'},{orderNum:14,partId:18,partName:'\u89E6\u63A7\u677F'},{orderNum:14,partId:67,partName:'USB3.0\u63A7\u5236\u5668'},{orderNum:16,partId:37,partName:'\u65E0\u7EBF\u7F51\u5361'},{orderNum:19,partId:23,partName:'\u8BFB\u5361\u5668'},{orderNum:22,partId:30,partName:'\u6444\u50CF\u5934'},{orderNum:31,partId:25,partName:'\u952E\u76D8'}]}

望高手解答!谢谢!
 楼主| 发表于 2013-8-27 13:50:00 | 显示全部楼层
望高手解答!谢谢!
发表于 2013-8-27 15:49:02 | 显示全部楼层
用 JSON的UDF可以解出来的。

http://www.autoitscript.com/foru ... -rfc4627-compliant/
 楼主| 发表于 2013-8-27 21:41:00 | 显示全部楼层
第二个信息量特别长,处理的时候总是提示:错误: 表达式错误 (不合规定的字符)
发表于 2013-8-28 14:36:32 | 显示全部楼层
autoit单行最大只能支持4095个字符,你那个超长了.

解决办法是手动拆分一下,比如

$a = "一部分文字" & _
        "另一部分文字" & _
        "剩下的文字"
确保不要超长.

当然,如果这个信息是直接通过读取文件或其他地方返回获取的,就不需要这样了.
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-24 20:50 , Processed in 0.069266 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表