Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to grab the second value of the duplicate keys? #1226

Open
mpanwala-wyn opened this issue Dec 6, 2023 · 0 comments
Open

How to grab the second value of the duplicate keys? #1226

mpanwala-wyn opened this issue Dec 6, 2023 · 0 comments

Comments

@mpanwala-wyn
Copy link

Here there are two values for the same "AttributeId": "7cf656a0-1f74-4ed0-bb06-7de031f6e05c" and every time if there are duplicate attributeIds I need to select the second value only, how would I do that in Jolt?

Input:

{
"sku": "00079821000742",
"assets": [
{
"AttributeId": "93d22e97-989a-49ed-b499-53909ae70cc2",
"Value": "f3ba8979-a3b1-444b-b34b-3852b189a700"
},
{
"AttributeId": "1b39ba3d-501e-4951-ae61-4259a63ce400",
"Value": "9a812cf5-1d54-40c7-a936-e3bef4125ade"
},
{
"AttributeId": "379b01a0-112d-4f55-92c1-ce3a8e5af045",
"Value": "a169c58d-87f3-4c68-a02f-dce46a036e4d"
},
{
"AttributeId": "7cf656a0-1f74-4ed0-bb06-7de031f6e05c",
"Value": "e3bb9fb3-c9f1-4cc0-ae9b-0c90b15da74d"
},
{
"AttributeId": "7cf656a0-1f74-4ed0-bb06-7de031f6e05c",
"Value": "8d28fb65-8fd4-4659-b0e1-367f708100a9"
}
]
}

Expected Output:
{
"sku" : "00079821000742",
"assets" : [ {
"AttributeId" : "93d22e97-989a-49ed-b499-53909ae70cc2",
"Value" : "f3ba8979-a3b1-444b-b34b-3852b189a700"
}, {
"AttributeId" : "1b39ba3d-501e-4951-ae61-4259a63ce400",
"Value" : "9a812cf5-1d54-40c7-a936-e3bef4125ade"
}, {
"AttributeId" : "379b01a0-112d-4f55-92c1-ce3a8e5af045",
"Value" : "a169c58d-87f3-4c68-a02f-dce46a036e4d"
}, {
"AttributeId" : "7cf656a0-1f74-4ed0-bb06-7de031f6e05c",
"Value" : "8d28fb65-8fd4-4659-b0e1-367f708100a9"
} ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant