[英]JOLT spec for nifi processor
I have following JSON input 我有以下JSON输入
{
"events": [
{
"cluster_id": "0717-035521-puny598",
"timestamp": 1535540053785,
"type": "TERMINATING",
"details": {
"reason": {
"code": "INACTIVITY",
"parameters": {
"inactivity_duration_min": "15"
}
}
}
},
{
"cluster_id": "0717-035521-puny598",
"timestamp": 1535537117300,
"type": "EXPANDED_DISK",
"details": {
"previous_disk_size": 29454626816,
"disk_size": 136828809216,
"free_space": 17151311872,
"instance_id": "6cea5c332af94d7f85aff23e5d8cea37"
}
}
]
}
I want to convert it into following. 我想将其转换为以下内容。
1) add one static key:value in each object of "events" array. 1)在“事件”数组的每个对象中添加一个静态key:value。 2) remove one element "type" from each object of "events" array.
2)从“事件”数组的每个对象中删除一个元素“类型”。 3) rest all values should be same in i/p and o/p.
3)其余所有值在i / p和o / p中应相同。 "details" is a object with no specific structure.
“细节”是没有特定结构的对象。
{
"events": [
{
"new_key" : "new_value",
"cluster_id": "0717-035521-puny598",
"timestamp": 1535540053785,
"details": {
"reason": {
"code": "INACTIVITY",
"parameters": {
"inactivity_duration_min": "15"
}
}
}
},
{
"new_key" : "new_value",
"cluster_id": "0717-035521-puny598",
"timestamp": 1535537117300,
"details": {
"previous_disk_size": 29454626816,
"disk_size": 136828809216,
"free_space": 17151311872,
"instance_id": "6cea5c332af94d7f85aff23e5d8cea37"
}
}
]
}
The following chain spec should work: 以下链式规格应该有效:
[
{
"operation": "default",
"spec": {
"events[]": {
"*": {
"new-key": "new-value"
}
}
}
},
{
"operation": "remove",
"spec": {
"events": {
"*": {
"type": ""
}
}
}
}
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.