【发布时间】:2019-11-01 11:40:15
【问题描述】:
假设我有以下 CamelContext:
<camelContext id="camelId" xmlns="http://camel.apache.org/schema/spring">
<route id="upsertItem">
<from uri="cxf:bean:someEndpoint" />
<process ref="someTransformer" />
<log message="$someJson"/>
</route>
</camelContext>
$someJson 包含以下 json:
{
"0":{
"title":"hello world",
"description":"a greeting to the world"
},
"1":{
"title":"goodbye world",
"description":"a goodbye to the world"
}
//might have more indexes
}
我想编辑我的 CamelContext 以便它可以将每个索引发布到端点。问题是我不知道如何遍历 JSON。
所以我想要一些看起来像这样的东西:
<loop src="${someJson[index]}">
<to uri="http://bookstore/api/books"/>
</loop>
【问题讨论】:
标签: java json apache-camel javabeans