这是一个简单的问题,我是nifi和jolt的新手。我只想知道,如何在使用通配符characters.For示例的同时遍历jolt规范,这是jolt演示站点中的一个示例
输入是
{
"data": {
"1234": {
"clientId": "12",
"hidden": true
},
"1235": {
"clientId": "35",
"hidden": false
}
}
}规格是
[
{
"operation": "shift",
"spec": {
"data": {
"*": {
"hidden": {
"true": {
// if hidden is true, then write the value disabled to the RHS output path
// Also @(3,clientId) means lookup the tree 3 levels, to the "1234" or "1235" level,
// and then come back down down the tree and grabe the value of "clientId"
"#disabled": "clients.@(3,clientId)"
},
"false": {
"#enabled": "clients.@(3,clientId)"
}
}
}
}
}
}
]输出结果是
{
"clients" : {
"12" : "disabled",
"35" : "enabled"
}
}我们是如何得到上面的输出的呢?就我所知,就像@(3,clientsid).As一样,它在what..the规范或输入方面走了3级up.But 3级?无论哪种方式,如何提升3个级别,您能定义一下这里的级别是什么吗?
提前感谢
发布于 2021-11-02 07:38:10
只需计算反向的每个左花括号({)或冒号(:)的数量。只要它们不是独立的,比如:{,为了到达目标键(在本例中就是"data"键下的"*"通配符),将其视为只有一个代码,对于@(3,clientId),第一级是在"#disabled"或"#enabled"旁边穿过冒号(:),第二级是在每个布尔键旁边的左花括号中交叉,然后第三级是在<>d11键之后交叉左大括号,以到达"data"键的索引对象。
https://stackoverflow.com/questions/69805887
复制相似问题