Created 04-09-2019 02:45 PM
I have a json flowfile with below content
{
"name":"abc"
}
I want the output should be
{
"name":"abc",
"attributes":{
"id":"12233",
"map":"Y"
}
}
How to achieve the same?
Created 04-09-2019 02:54 PM
You can use UpdateRecord for this, but make sure you have the additional fields in your writer's schema. Alternatively you can use JoltTransformJSON with the following spec:
[
{
"operation": "default",
"spec": {
"attributes": {
"id": "12233",
"map": "Y"
}
}
}
]
Created 04-09-2019 02:54 PM
You can use UpdateRecord for this, but make sure you have the additional fields in your writer's schema. Alternatively you can use JoltTransformJSON with the following spec:
[
{
"operation": "default",
"spec": {
"attributes": {
"id": "12233",
"map": "Y"
}
}
}
]
Created 06-03-2019 05:09 PM
@Matt Burgess do you mind helping me out with a similar issue?
I have a json file comming in as :
[ {
"regId" : "us",
"cId" : "SomeProduct",
"weId" : 15,
"name" : "R",
"id" : 1539,
"cityId" : 17,
"cityName" : "Moskow"
}, {
"regId" : "us",
"cId" : "SomeProduct",
"weId" : 15,
"name" : "R",
"id" : 1540,
"cityId" : 18,
"cityName" : "Berlin"
}, {
"regId" : "us",
"cId" : "SomeProduct",
"weId" : 15,
"name" : "R",
"id" : 1541,
"cityId" : 19,
"cityName" : "Vienna"
} ]I need to add 3 new fields passed from the FlowFile attribute into each element? Can I do that with the update Record also?
[ {
"new_att":"somevalue",
"new_att2":"somevalue2",
"new_att3":"somevalue3",
"regId" : "us",
"cId" : "SomeProduct",
"weId" : 15,
"name" : "R",
"id" : 1539,
"cityId" : 17,
"cityName" : "Moskow"
}, {
"new_att":"somevalue",
"new_att2":"somevalue2",
"new_att3":"somevalue3",
"regId" : "us",
"cId" : "SomeProduct",
"weId" : 15,
"name" : "R",
"id" : 1540,
"cityId" : 18,
"cityName" : "Berlin"
}, {
"new_att":"somevalue",
"new_att2":"somevalue2",
"new_att3":"somevalue3",
"regId" : "us",
"cId" : "SomeProduct",
"weId" : 15,
"name" : "R",
"id" : 1541,
"cityId" : 19,
"cityName" : "Vienna"
} ]Thanks,
Rosa