mardi 29 décembre 2020

How to add json attribute value depend on existing value using apache nifi

I have a json data format as foloowing,

{
    "sensordata":{
        "sensorId":20,
        "dataValue":525.0,
        "date":"2020:12:29"
    }
}

I want to add new attribute called exceeded depending on the dataValue attribute, If datavalue is greater than 30 I want to assign true for the exceeded attribute, else false

output look like this,

{
    "sensordata":{
        "sensorId":20,
        "dataValue":525.0,
        "date":"2020:12:29",
        "exceeded":"true"
    }
}

my current dataflow is as follow, enter image description here

Aucun commentaire:

Enregistrer un commentaire