我想以下面的JSON文件拆分成2个FlowFiles申请SplitJson
(根据hits
):我应该使用哪个JSONPath表达式来拆分我的JSON字符串?
{"took":0,"timed_out":false,"_shards":
{"total":5,"successful":5,"failed":0},
"hits":{"total":2,"max_score":0.0,
"hits":
[
{"_index":"my_index","_type":"my_entry","_id":"111","_score":0.0,"_source":{"ZoneId":"1","OriginId":"1"},
"fields":{"ttime":[11000]}},
{"_index":"my_index","_type":"my_entry","_id":"222","_score":0.0,"_source":{"ZoneId":"1","OriginId":"2"},
"fields":{"ttime":[5000]}}
]
}
}
我应该使用哪种JsonPath Expression
?我试过$.hits[*]
,但它会根据第一级hits
分割内容。在我的情况下,我有hits[hits[...]]
,但我应该如何在表达式中指定它?
UPDATE:
我希望得到两个FlowFiles:
FlowFile#1:{"_index":"my_index","_type":"my_entry","_id":"111","_score":0.0,"_source":{"ZoneId":"1","OriginId":"1"},"fields":{"ttime":[11000]}}
FlowFile#2: {"_index":"my_index","_type":"my_entry","_id":"222","_score":0.0,"_source":{"ZoneId":"1","OriginId":"2"},"fields":{"ttime":[5000]}}
是的,它工作正常。为什么'$ .hits.hits [*]'不起作用? – Dinosaurius
它应该如果你修改后的方法。看看结果在http://jsonpath.com/中的细微差别? – DanteTheSmith