我正在将xml文件转换为Json格式,我正在尝试使用linq.js查询Json 到目前为止,这就是我所做的:
var queryResult = linq.from(result).where( function(x){ return x.key == "bpmn2:definitions" } ).select(function(x) { return x } ).toArray();
我得到以下json:
[ { key: 'bpmn2:definitions',
value:
{ '$': [Object],
'bpmn2:message': [Object],
'bpmn2:interface': [Object],
process: [Object] } } ]
如何通过修改名为 Process 的嵌入对象的where子句来获取同一查询?
修改
到目前为止我已经做到了:
var queryResult = linq.from(result).where( function(x){ return x.key == "bpmn2:definitions" } ).select(function(x) { return x.value.process } ).toArray();
我得到了
[ [ { '$': [Object],
'bpmn2:process': [Object],
'bpmndi:BPMNDiagram': [Object] } ] ]
如何在上述同一查询中访问bpmn2:process?
感谢您的帮助
答案 0 :(得分:1)
喜欢这个?我认为这就是你所要求的。
var queryResult = linq.from(result).where( function(x){ return x.key == "bpmn2:definitions" } ).select(function(x) { return x.value.process } ).toArray();