可以的话,最好是用解释器调用JS,自定义几个函数就可以判断对象和获取对象属性。
程序代码:
TEXT TO cJson TEXTMERGE NOSHOW PRETEXT 15
{"traces":[{"acceptTime":"2016-12-03 12:24:25","acceptAddress":"宿州市","remark":"宿州市邮政速递公司北区揽投部已收件(揽投员姓名:陆登杰,联系电话:18955780863)"},{"acceptTime":"2016-12-03 18:45:11","acceptAddress":"宿州市","remark":"离开宿州市 发往蚌埠市"},{"acceptTime":"2016-12-03 21:13:10","acceptAddress":"蚌埠市","remark":"到达蚌埠市处理中心(经转)"},{"acceptTime":"2016-12-03 21:14:29","acceptAddress":"蚌埠市","remark":"离开蚌埠市 发往南京市(经转)"},{"acceptTime":"2016-12-04 01:31:00","acceptAddress":"南京市","remark":"到达EMS航空集散中心(南京)处理中心(经转)"},{"acceptTime":"2016-12-04 06:34:00","acceptAddress":"南京市","remark":"离开南京市 发往北京市(经转)"},{"acceptTime":"2016-12-04 08:39:00","acceptAddress":"北京市","remark":"到达 中国邮政速递物流股份有限公司北京市邮件处理中心(航 处理中心"},{"acceptTime":"2016-12-04 11:22:04","acceptAddress":"北京市","remark":"离开中国邮政速递物流股份有限公司北京市国货航航空邮件处 发往北京邮政速递上地区域分公司清华营投部"},{"acceptTime":"2016-12-04 13:23:00","acceptAddress":"北京市","remark":"北京邮政速递上地区域分公司清华营投部安排投递,预计23:59:00前投递"},{"acceptTime":"2016-12-04 15:50:40","acceptAddress":"北京市","remark":"投递并签收,签收人:本人收"}]}
ENDTEXT
TEXT TO jsCode TEXTMERGE NOSHOW PRETEXT 15
<script>
var json = function(jsonString){return JSON.parse(jsonString);};
var toString = function(obj){return Object.prototype.toString.call(obj);};
var getValue = function(obj,name){return obj[name];};
var isArray = function(obj){return Array.isArray(obj);};
var getArray = function(obj,num){return obj[num];};
</script>
ENDTEXT
dom = CREATEOBJECT("htmlfile")
dom.write(jsCode)
win = dom.parentWindow
json = win.json(cJson)
? win.toString(json.traces)
? win.isArray(json.traces)
FOR i=0 TO json.traces.length-1
obj = win.getArray(json.traces,i)
? win.getValue(obj,"acceptAddress"), win.getValue(obj,"remark")
ENDFOR
[此贴子已经被作者于2023-7-13 06:44编辑过]