我有来自 REST API 的 JSON 输出,输出如下所示:
{
"sprints": [{
"id": 10516,
"sequence": 10516,
"name": "SP121 - BRK relief",
"state": "CLOSED",
"linkedPagesCount": 0
}, {
"id": 10447,
"sequence": 10447,
"name": "SP120 - Plannibal Smith",
"state": "CLOSED",
"linkedPagesCount": 0
}, {
"id": 10391,
"sequence": 10391,
"name": "SP119 - Don't bug or bend over",
"state": "CLOSED",
"linkedPagesCount": 0
}, {
"id": 10244,
"sequence": 10244,
"name": "SP118 - Be an all grounder!",
"state": "CLOSED",
"linkedPagesCount": 0
}, {
"id": 10183,
"sequence": 10183,
"name": "SP117 - The R Factor",
"state": "CLOSED",
"linkedPagesCount": 0
}, {
"id": 10182,
"sequence": 10182,
"name": "SP116 - Deliverfull",
"state": "CLOSED",
"linkedPagesCount": 0
}, {
"id": 10123,
"sequence": 10123,
"name": "SP115 - Appartemenneke",
"state": "CLOSED",
"linkedPagesCount": 0
}],
"velocityStatEntries": {
"10516": {
"estimated": {
"value": 10.0,
"text": "10.0"
},
"completed": {
"value": 7.5,
"text": "7.5"
}
},
"10244": {
"estimated": {
"value": 15.5,
"text": "15.5"
},
"completed": {
"value": 7.5,
"text": "7.5"
}
},
"10182": {
"estimated": {
"value": 12.0,
"text": "12.0"
},
"completed": {
"value": 10.0,
"text": "10.0"
}
},
"10391": {
"estimated": {
"value": 16.0,
"text": "16.0"
},
"completed": {
"value": 3.0,
"text": "3.0"
}
},
"10183": {
"estimated": {
"value": 12.0,
"text": "12.0"
},
"completed": {
"value": 7.0,
"text": "7.0"
}
},
"10123": {
"estimated": {
"value": 11.5,
"text": "11.5"
},
"completed": {
"value": 5.5,
"text": "5.5"
}
},
"10447": {
"estimated": {
"value": 7.0,
"text": "7.0"
},
"completed": {
"value": 3.0,
"text": "3.0"
}
}
}}
我想从velocityStatEntries中提取叶子和叶子内部的信息。
所以预期的输出是这样的:
sprint_id |估计|完全的
10516 | 10516 10.0 | 7.5
10244 | 10244 15.5 | 15.5 7.5
ETC。
奇怪的是,当我尝试通过在线 JSONpath 测试器 (jsonpath.curiousconcept.com/) 执行此操作时,我通过类似“$.velocityStatEntries”的查询得到了预期结果。我得到这个:
[ {
"10516":{
"estimated":{
"value":10,
"text":"10.0"
},
"completed":{
"value":7.5,
"text":"7.5"
}
},
"10244":{
"estimated":{
"value":15.5,
"text":"15.5"
},
"completed":{
"value":7.5,
"text":"7.5"
}
},
"10182":{
"estimated":{
"value":12,
"text":"12.0"
},
"completed":{
"value":10,
"text":"10.0"
}
},
"10391":{
"estimated":{
"value":16,
"text":"16.0"
},
"completed":{
"value":3,
"text":"3.0"
}
},
"10183":{
"estimated":{
"value":12,
"text":"12.0"
},
"completed":{
"value":7,
"text":"7.0"
}
},
"10123":{
"estimated":{
"value":11.5,
"text":"11.5"
},
"completed":{
"value":5.5,
"text":"5.5"
}
},
"10447":{
"estimated":{
"value":7,
"text":"7.0"
},
"completed":{
"value":3,
"text":"3.0"
}
}}]
但因为我使用的是 Talend Open Studio,所以我必须输入 Loop Jsonpath 查询,然后指定映射。有谁知道如何在 Talend 中解决这个问题?我正在使用 tExtractJSONFields 组件
编辑:一些额外的屏幕截图以获取额外信息
Job1:
Output1:
无法发布更多屏幕,因为我没有足够的声誉点...:(