Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created on
09-12-2022
04:58 AM
- last edited on
09-12-2022
09:37 AM
by
DianaTorres
Hi Everyone,
i would like to add an attribute to the following json file using the jolt transfomr processor. Unfortunately my json file remains unchanged with the following transformation
Original Json File
{
"logs": [],
"ranges": [
{
"day": "2022-08-31T22:00:00.000Z",
"manager": {
"costByRemunerationId": [],
"total": 0,
"totalHours": 0,
"ancillaryCost": 0
},
"crew": {
"costByRemunerationId": [
{
"remunerationId": "salary",
"remunerationUnit": 2,
"compensation": 76.66666666666667,
"worktimeInH": 0,
"durationInDays": 0,
"quantity": 0,
"ancillaryCost": 15.854666666666667
}
],
"total": 76.66666666666667,
"totalHours": 0,
"ancillaryCost": 15.854666666666667
},
"trainee": {
"costByRemunerationId": [],
"total": 0,
"totalHours": 0,
"ancillaryCost": 0
},
"apprentice": {
"costByRemunerationId": [],
"total": 0,
"totalHours": 0,
"ancillaryCost": 0
},
"total": 76.66666666666667,
"totalHours": 0,
"ancillaryCost": 15.854666666666667
},
{
"day": "2022-09-01T22:00:00.000Z",
"manager": {
"costByRemunerationId": [],
"total": 0,
"totalHours": 0,
"ancillaryCost": 0
},
"crew": {
"costByRemunerationId": [
{
"remunerationId": "normalHours",
"remunerationUnit": 0,
"compensation": 0,
"worktimeInH": 7.8329297222222225,
"durationInDays": 2,
"quantity": 0,
"ancillaryCost": 0
},
{
"remunerationId": "salary",
"remunerationUnit": 2,
"compensation": 76.66666666666667,
"worktimeInH": 0,
"durationInDays": 0,
"quantity": 0,
"ancillaryCost": 15.854666666666667
}
],
"total": 76.66666666666667,
"totalHours": 7.8329297222222225,
"ancillaryCost": 15.854666666666667
},
"trainee": {
"costByRemunerationId": [],
"total": 0,
"totalHours": 0,
"ancillaryCost": 0
},
"apprentice": {
"costByRemunerationId": [],
"total": 0,
"totalHours": 0,
"ancillaryCost": 0
},
"total": 76.66666666666667,
"totalHours": 7.8329297222222225,
"ancillaryCost": 15.854666666666667
}
]
}
Jolt Transform
[
{
"operation": "modify-default-beta",
"spec": {
"*": {
"target.organisation": "${target.organisation}"
}
}
}
]
Expected result
{
"logs": [],
"ranges": [
{
"day": "2022-08-31T22:00:00.000Z",
"manager": {
"costByRemunerationId": [],
"total": 0,
"totalHours": 0,
"ancillaryCost": 0
},
"crew": {
"costByRemunerationId": [
{
"remunerationId": "salary",
"remunerationUnit": 2,
"compensation": 76.66666666666667,
"worktimeInH": 0,
"durationInDays": 0,
"quantity": 0,
"ancillaryCost": 15.854666666666667
}
],
"total": 76.66666666666667,
"totalHours": 0,
"ancillaryCost": 15.854666666666667
},
"trainee": {
"costByRemunerationId": [],
"total": 0,
"totalHours": 0,
"ancillaryCost": 0
},
"apprentice": {
"costByRemunerationId": [],
"total": 0,
"totalHours": 0,
"ancillaryCost": 0
},
"total": 76.66666666666667,
"totalHours": 0,
"ancillaryCost": 15.854666666666667
},
{
"day": "2022-09-01T22:00:00.000Z",
"manager": {
"costByRemunerationId": [],
"total": 0,
"totalHours": 0,
"ancillaryCost": 0
},
"crew": {
"costByRemunerationId": [
{
"remunerationId": "normalHours",
"remunerationUnit": 0,
"compensation": 0,
"worktimeInH": 7.8329297222222225,
"durationInDays": 2,
"quantity": 0,
"ancillaryCost": 0
},
{
"remunerationId": "salary",
"remunerationUnit": 2,
"compensation": 76.66666666666667,
"worktimeInH": 0,
"durationInDays": 0,
"quantity": 0,
"ancillaryCost": 15.854666666666667
}
],
"total": 76.66666666666667,
"totalHours": 7.8329297222222225,
"ancillaryCost": 15.854666666666667
},
"trainee": {
"costByRemunerationId": [],
"total": 0,
"totalHours": 0,
"ancillaryCost": 0
},
"apprentice": {
"costByRemunerationId": [],
"total": 0,
"totalHours": 0,
"ancillaryCost": 0
},
"total": 76.66666666666667,
"totalHours": 7.8329297222222225,
"ancillaryCost": 15.854666666666667
}
],
"target.organisation": myorganisation
}
Thanks for idea what is still missing from my query
Created on 09-12-2022 07:38 AM - edited 09-12-2022 07:39 AM
Hi,
I dont think you need the asterisk "*" in the spec, since you need it on the first level and you dont need to reference any other fields. Just have your spec as follows:
[
{
"operation": "modify-default-beta",
"spec": {
"target.organisation": "${target.organisation}"
}
}
]
Created on 09-12-2022 07:38 AM - edited 09-12-2022 07:39 AM
Hi,
I dont think you need the asterisk "*" in the spec, since you need it on the first level and you dont need to reference any other fields. Just have your spec as follows:
[
{
"operation": "modify-default-beta",
"spec": {
"target.organisation": "${target.organisation}"
}
}
]