Given dynamic accountId return the onlineId and signinId for that specific user.
Input JSON:
[
{
"request": {
"body": {
"inputAccountId": "1234"
}
}
},
{
"accountId": "1234",
"ageGroup": 3,
"role": 1,
"gender": "f",
"signinId": "[email protected]",
"onlineId": "one"
},
{
"accountId": "1122",
"ageGroup": 3,
"role": 2,
"gender": "f",
"signinId": "[email protected]",
"onlineId": "two"
},
{
"accountId": "2211",
"ageGroup": 1,
"role": 1,
"gender": "f",
"signinId": "[email protected]",
"onlineId": "three"
}
]
If accountId = 1234 or accountId could be any account either 1122, or 2211 as well based on use case, then return the output JSON for that accountId.
Jolt:
[
{
"operation": "modify-overwrite-beta",
"spec": {
"request": {
"inputAccountId": "@(3,request.body.inputAccountId)"
}
}
},
{
"operation": "shift",
"spec": {
"request": {
"inputAccountId": "requestedId"
},
"1": {
"*": {
"accountId": {
"requestedId": {
"onlineId": "onlineId",
"signinId": "signInId"
}
}
}
}
}
}
]
I am not able to get the above code working.. The Java throws error –
java.lang.NullPointerException" when reading the JOLT Spec file.
I also tried ${requestedId} but it goes as numeric, so I added it as requestedId which throws nullPointer exception.
2
Answers
@Barbaros Özhan Do you know how we can get the masked signInID like first characters+@+domainName for the inputId? First character length is based on the nameSize. I have the below logic which works for my other files as per the spec, but in this one I am not able to get to the point -
How it is accessed in operation -
You can use the following transformation specs :