Created 04-26-2023 08:17 AM
Hi Jolt Experts,
Iam looking to use the Jolt transformation in NIFI and looking for a help.
{
"header": {
"timeStamp": "1681441547144",
"activityId": "5142917973836294867"
},
"resource": {
"drniId": "261968731599587823",
"@type": "Order",
"subtype": "Retail",
"name": "CCCCC",
"resourceCharacteristic": [
{
"propname": "aaa",
"value": "P_1655442"
},
{
"name": "latest",
"value": [
11,
200,
300,
16,
2,
3
]
}]
}
}
To have an output like
{
"records" : [ {
"timeStamp" : "1681441547144",
"activityId" : "5142917973836294867",
"drniId" : "261968731599587823",
"type" : "Order",
"subtype" : "Retail",
"name" : "CCCCC",
"propname" : "aaa",
"value" : "P_1655442"
}, {
"timeStamp" : "1681441547144",
"activityId" : "5142917973836294867",
"drniId" : "261968731599587823",
"type" : "Order",
"subtype" : "Retail",
"name" : "CCCCC",
"propname" : "latest",
"value" : "11,200,300,16,2,3"
} ]
}
Basically copying all the top header and resource into to new by flattening it. Any help appreciated.
Created 04-26-2023 10:58 AM
Want to get a detailed solution you have to login/registered on the community
Register/LoginCreated 05-02-2023 09:48 AM
Want to get a detailed solution you have to login/registered on the community
Register/LoginCreated 04-26-2023 10:58 AM
Want to get a detailed solution you have to login/registered on the community
Register/LoginCreated 04-30-2023 08:10 PM
Thanks @SAMSAL .It worked. In the same way how do i get an simillar output for "resourceRelationshipCharacteristic" . i tried few option but not getting the desirable output.
{
"header": {
"version": "1.0",
"timeStamp": "1681441547144",
"activityId": "5142917973836294867",
"action": "modify"
},
"resource": {
"drniId": "261968731599587823",
"@type": "VVVVV",
"subtype": "BBBBBB",
"name": "VVVVVVV",
"resourceCharacteristic": [
{
"name": "matchingkey",
"value": "CCCCC",
"@type": "string"
}
],
"resourceRelationship": [
{
"drniId": "261968731599587635",
"@type": "CCCCCC",
"subtype": "OTU4",
"name": "BBBBBB",
"relationDrniId": "5143209344417655493",
"resourceRelationshipCharacteristic": [
{
"name": "p3Latest",
"value": true,
"@type": "boolean"
},
{
"name": "isNotInRoute",
"value": "N",
"@type": "string"
}
]
},
{
"drniId": "261988866406271344",
"@type": "BVDFDFS",
"subtype": "VDFDG",
"name": "ABCC",
"relationDrniId": "5143209344417655494",
"resourceRelationshipCharacteristic": [
{
"name": "p3Latest",
"value": true,
"@type": "boolean"
},
{
"name": "isNotInRoute",
"value": "N",
"@type": "string"
}
]
}
]
}
}
Created 05-01-2023 06:30 AM
Hi ,
Can you provide the expected json output? The json you provided seems complex and nested. I'm not sure what exactly you are expecting.
Created 05-01-2023 05:08 PM
Basically inhertied properties of header and resource inside resourceRelationshipCharacteristic
{
"records" : [ {
"relationDrniId" : "5143209344417655493",
"timeStamp" : "1681441547144",
"activityId" : "5142917973836294867",
"action" : "modify",
"name": "p3Latest",
"value": true,
"@type": "boolean"
},
{
"relationDrniId" : "5143209344417655493",
"timeStamp" : "1681441547144",
"activityId" : "5142917973836294867",
"action" : "modify",
"name": "isNotInRoute",
"value": "N",
"@type": "string"
} ,
{
"relationDrniId" : "5143209344417655494",
"timeStamp" : "1681441547144",
"activityId" : "5142917973836294867",
"action" : "modify",
"name": "p3Latest",
"value": true,
"@type": "boolean"
} ,
"relationDrniId" : "5143209344417655494",
"timeStamp" : "1681441547144",
"activityId" : "5142917973836294867",
"action" : "modify",
"name": "isNotInRoute",
"value": "N",
"@type": "string"
}
]
}
Created 05-02-2023 09:48 AM
Want to get a detailed solution you have to login/registered on the community
Register/LoginCreated 05-02-2023 07:11 PM
Thanks @SAMSAL You are a genius. I was caught with the duplicate index array and couldn't resolve.
Created 05-08-2023 05:29 AM
I have used the below spec for moving some of the resource characterstic to top level but iam getting null values.
[
{
"operation": "shift",
"spec": {
"header": {
"timeStamp": "records.inv_activity_ts",
"activityId": "records.inv_activity_id",
"action": "records.action"
},
"resource": {
"drniId": "records.inv_id",
"subtype": "records.inv_subtype",
"name": "records.inv_name",
"resourceCharacteristic": {
"*": {
"name": {
"matchingkey": "records.matchingkey-value",
"status": "records.status-value"
},
"value": {
"matchingkey": "records.matchingkey-value",
"status": "records.status-value"
}
}
}
}
}
}
]
Output iam getting
{
"records" : {
"inv_activity_ts" : "1670484663189",
"inv_activity_id" : "256388257993155783",
"action" : "create",
"inv_id" : "256383859946641699",
"inv_subtype" : "Backplane Connection",
"inv_name" : "Backplane Connection",
"matchingkey-value" : null,
"status-value" : null
}
}
What is mistake iam making?.