This is another JSON transformer problem where I need some help, next to this one
Given the following JSON where fileKey
is an optional field (can be present or not):
{
"invoiceState": {
"userId": "832eac3d-89d2-428c-9007-688b3e590533",
"invoices": {
"407613d7-7dc0-4cd6-8d62-41eea7067ca0": {
"fileKey": {
"key": "407613d7-7dc0-4cd6-8d62-41eea7067ca4"
},
"externalId": "I-000000-000000"
},
"8d16b2f8-ced0-4b41-8b6b-b275709ba88a": {
"externalId": "I-000000-000001"
}
}
}
}
I would like to transform it to this:
{
"invoiceState": {
"userId": "832eac3d-89d2-428c-9007-688b3e590533",
"invoices": {
"407613d7-7dc0-4cd6-8d62-41eea7067ca0": {
"file": {
"path": "407613d7-7dc0-4cd6-8d62-41eea7067ca4",
"createdTime": "Some UTC time"
},
"externalId": "I-000000-000000"
},
"8d16b2f8-ced0-4b41-8b6b-b275709ba88a": {
"externalId": "I-000000-000001"
}
}
}
}
The main problem is the fact that the fileKey
field is optional.
I would also appreciate some help here.