NiFi JoltTransformJSON 2.0.0 trasform JSON flowfile
Hi Everyone,
Struggling with transforming the JSON flow file, would appreciate help from the community!
input json flow file:
[{
"firstName": "John",
"LastName": "Malkovich",
"MiddleName": "J",
"nameType": {
"type1": "Other"
"type2": "Primary"
}
}, {
"firstName": "Johnny",
"LastName": "Cage",
"MiddleName": "M",
"nameType": {
"type1": "Basic"
"type2": "Primary"
}
}
]
expected output json flow file:
{
"fileName": "file.xml",
"count": "2",
"individuals": [{
"firstName": "John",
"LastName": "Malkovich",
"MiddleName": "J",
"nameType": {
"type1": "Other"
"type2": "Primary"
}
}, {
"firstName": "Johnny",
"LastName": "Cage",
"MiddleName": "M",
"nameType": {
"type1": "Basic"
"type2": "Primary"
}
}
]
}
Jolt specification :
[ { "operation": "default", "spec": { "fileName": "file.xml"", "count": "=2" } }, { "operation": "shift", "spec": { "*": { "@": "individuals[]" } } } ]
gettingError:
TransformException: The Spec provided can not handle input that is a top level Json Array.

