Please help me to provide JOLT spec for the below input JSON. tried multiple approach but still not working. there is an condition check on risk attribute if risk is “0” then risklevel low .if it is “1” then High if it is null then it should be null only i got a solution but for null value output json attribute is not showing.
Input JSON :
[
{
"id": "12",
"name": "Manu",
"age": 26,
"location": "New York",
"risk": "0"
},
{
"id": "12",
"name": "Manju",
"age": 29,
"location": "New York",
"risk": null
},
{
"id": "123",
"name": "sanju",
"age": 24,
"location": "New York city",
"risk": "1"
},
{
"id": "1234",
"name": "Ramesh",
"age": 23,
"location": "India",
"risk": null
}
]
Expected JSON :
[
{
"id": "12",
"location": "New York",
"user": [
{
"name": "Manu",
"age": 26,
"riskLevel": "Low"
},
{
"name": "Manju",
"age": 29,
"riskLevel": null
}
]
},
{
"id": "123",
"location": "New York city",
"user": [
{
"name": "sanju",
"age": 24,
"riskLevel": "High"
}
]
},
{
"id": "123",
"location": "India",
"user": [
{
"name": "Ramesh",
"age": 23,
"riskLevel": null
}
]
}
]
New contributor
Manjunath k is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.