Member since
06-11-2019
4
Posts
2
Kudos Received
0
Solutions
01-26-2021
03:21 AM
1 Kudo
Hello, I am working with the JoltTransformJSON processor, which I consider to be very powerful but complicated to use and there is not much documentation about it. I have the following input JSON: {
"logTypeCode":"FIN",
"eventNumber":"1",
"eventTime":1568066703172,
"eventInfo":{
"eventId":"CREATE_DOMESTIC_STANDING_ORDER",
"eventVersion":"1"
},
"operationInfo":{
"operationId":"DOMESTIC_STANDING_ORDER"
}
} And my output JSON I need it to be the following: {
"body":{
"logTypeCode":"END_OF_TESTING",
"eventNumber":"1",
"eventTime":1568066703172,
"eventInfo":{
"eventId":"CREATE_DOMESTIC_STANDING_ORDER",
"eventVersion":"1"
},
"operationInfo":{
"operationId":"DOMESTIC_STANDING_ORDER"
}
},
"header":{
"date":"${dateInPropertiesFlow}"
},
"customValue":{
"logTypeCode":"END_OF_TESTING",
"ENV":"${anotherPropertie}"
}
} basically, I want to group everything that comes to me inside the "body" field, then I need to create another field that is called "header", which contains a single field called "date" with the value of a property that comes to me by the flow, and finally I need a field that is called "customValue", where the value "logTypeCode" has to have the same value as the field that is in "body.logTypeCode". I'm trying several ways in the application https://jolt-demo.appspot.com/#inception but I can't get it to work as I want, for now this is the closest I got.... [
{
"operation": "shift",
"spec": {
"*": "body.&"
}
},
{
"operation": "default",
"spec": {
"header": {
"date": "${paramDate}"
}
}
}
] I've been doing a lot of tests, but I can't get the result I need... Help! Thanks
... View more
Labels:
- Labels:
-
Apache NiFi
06-18-2019
05:59 AM
thanks!! it's works
... View more
06-17-2019
11:23 AM
1 Kudo
Hello everyone, first at all, i am kind of newbie with nifi so feel free to change everywhting you see. I am ussing JoltTransformJSON. My input JSON is the next one: { "ID": "123", "Text1": "aaa", "Text2": "aaa", "Text3": "aaa" } And i need the next output: { "data": { "ID": "123", "Text1": "aaa", "Text2": "aaa", "Text3": "aaa" }, "date": "", "dataset": "", "ID": "123" } The var date and dataset are attributes from the flow, so there is no problem here, the problem is i need to extract the value of ID, in this case 123 but this is just an example, without deleted the ID inside de field data. My Jolt Specification is the next one: [{ "operation": "shift", "spec": { "*": "data.&" } }, { "operation": "default", "spec": { "dataset": "${dataset:toLower()}", "date": "${date}" } }] and with that i have all EXCEPT the ID field, that i dont know how to do it :(. Thankss
... View more
Labels:
- Labels:
-
Apache NiFi