I have below JSON, where I want to compare "categoryType" value with categories' object's "type" and pick up the matching object. Please find the details below,
Input
{
"categoryType": "A",
"categories": [
{
"type": "A",
"issue": "1"
},
{
"type": "B",
"issue": "2"
},
{
"type": "C",
"issue": "3"
}
]
}
Expected Output
{
"category" : {
"type" : "A",
"issue" : "1"
}
}
My JOLT Configuration
[
{
"operation": "shift",
"spec": {
"categories": {
"*": {
"type": {
"@(3,categoryType)": {
"@2": "category"
}
}
}
}
}
}
]
And the output I am getting is as below, which is incorrect because @(3,categoryType) value is "A", so it should only pick up the "type" matching the value "A". If I replace "@(3,categoryType)" with "A", it will pick up only one object matching the type "A". Any idea how to resolve this issue?
{
"category" : [ {
"type" : "A",
"issue" : "1"
}, {
"type" : "B",
"issue" : "2"
}, {
"type" : "C",
"issue" : "3"
} ]
}
I have below JSON, where I want to compare "categoryType" value with categories' object's "type" and pick up the matching object. Please find the details below,
Input
{
"categoryType": "A",
"categories": [
{
"type": "A",
"issue": "1"
},
{
"type": "B",
"issue": "2"
},
{
"type": "C",
"issue": "3"
}
]
}
Expected Output
{
"category" : {
"type" : "A",
"issue" : "1"
}
}
My JOLT Configuration
[
{
"operation": "shift",
"spec": {
"categories": {
"*": {
"type": {
"@(3,categoryType)": {
"@2": "category"
}
}
}
}
}
}
]
And the output I am getting is as below, which is incorrect because @(3,categoryType) value is "A", so it should only pick up the "type" matching the value "A". If I replace "@(3,categoryType)" with "A", it will pick up only one object matching the type "A". Any idea how to resolve this issue?
{
"category" : [ {
"type" : "A",
"issue" : "1"
}, {
"type" : "B",
"issue" : "2"
}, {
"type" : "C",
"issue" : "3"
} ]
}