I have an input like this –
[
{
"time": "2014-10-31T01:59:59.000+10:00",
"value": {
"nil": null
},
"metadata": {
"TVPMeasurementMetadata": {
"qualifier": {
"title": null,
"href": null
}
}
},
"longitude": "115.1248985",
"latitude": "-33.963617",
"gathered_time": "1685662804091"
},
{
"time": "2014-11-30T02:00:00.000+10:00",
"value": {
"nil": null
},
"metadata": {
"TVPMeasurementMetadata": {
"qualifier": {
"title": null,
"href": null
}
}
},
"longitude": "115.1248985",
"latitude": "-33.963617",
"gathered_time": "1685662804091"
},
{
"time": "2014-12-10T02:00:00.000+10:00",
"value": 83.939,
"metadata": null,
"longitude": "115.1248985",
"latitude": "-33.963617",
"gathered_time": "1685662804091"
},
{
"time": "2014-12-11T02:00:00.000+10:00",
"value": 84.089,
"metadata": null,
"longitude": "115.1248985",
"latitude": "-33.963617",
"gathered_time": "1685662804091"
}
]
What I want is to only get values the JSON objects that have numerical data in them and don’t equal {"nil": null} … Here’s what the expected output looks like.
[
{
"time" : "2014-12-10T02:00:00.000+10:00",
"value" : 83.939,
"metadata" : null,
"longitude" : "115.1248985",
"latitude" : "-33.963617",
"gathered_time" : "1685662804091"
}, {
"time" : "2014-12-11T02:00:00.000+10:00",
"value" : 84.089,
"metadata" : null,
"longitude" : "115.1248985",
"latitude" : "-33.963617",
"gathered_time" : "1685662804091"
}
]
I tried a couple different specs operations like remove but those didn’t get me anywhere.
2
Answers
This is your Jolt spec: