问题描述
- 求正则表达式大神帮我处理下面的问题!谢谢了
-
{"EmpBar":"上海","EmpAdd":"长宁","Table1":[{"_row":1,"EmpCode":"EF0001","ConName":"张三","Table2":[{"_row":1,"ConPost":"Java工程师","ConPhone":"138171796041"},{"_row":2,"ConPost":"PHP工程师","ConPhone":"138171796042"}]},{"_row":2,"EmpCode":"EF0001","ConName":"李四","Table2":[{"_row":1,"ConPost":"SQL工程师","ConPhone1":"13817179604"},{"_row":2,"ConPost":"Oracle工程师","ConPhone1":"13817179604"}]}]}需要把Table1 Table2用正则表达式取出来,提问分不多。下载分有不少,问题解决厚谢
解决方案
怎么解析啊! 试了好几种方法了呢
解决方案二:
直接用json解析不可以么?告诉我你用的语言。
解决方案三:
建立好类,用服务器端的json类库反序列一下就好了吧。。
解决方案四:
用js解析的话就是下面这样
<script>
var a={"EmpBar":"上海","EmpAdd":"长宁","Table1":[{"_row":1,"EmpCode":"EF0001","ConName":"张三","Table2":[{"_row":1,"ConPost":"Java工程师","ConPhone":"138171796041"},{"_row":2,"ConPost":"PHP工程师","ConPhone":"138171796042"}]},{"_row":2,"EmpCode":"EF0001","ConName":"李四","Table2":[{"_row":1,"ConPost":"SQL工程师","ConPhone1":"13817179604"},{"_row":2,"ConPost":"Oracle工程师","ConPhone1":"13817179604"}]}]};
var table1 = a['Table1'];
for(var i=0;i<table1.length;i++){
var table2 = table1[i]['Table2'];
for(var j=0;j<table2.length;j++){
console.log(table2[j]['ConPost']);
}
}
</script>
解决方案五:
table1,table2就是两个json数组。各个语言都有支持的类库。根据你的语言来访问
时间: 2024-10-26 17:21:10