'JSON conversion using JOLT with ARRAY - remove $id
someone can me help? I'm new to jolt. Can you please tell me how can i trasform the below json message with array based upon the position in to the below output json message using jolt.
My JSON is:
{
"rotas": [
{
"$id": "49122583",
"nomeRota": "BRAGANÇA PAULISTA",
"placa": "EVQ6280",
"nomeMotorista": "MARCO ANTONIO",
"dataSaida": "2022-05-02T07:00:00-03:00",
"dataChegada": "2022-05-02T13:23:09.6-03:00",
"tipoVeiculo": "VUC",
"documentoTransportadora": "52912748000679",
"codigoTransportadora": "52912748000679",
"custoFrete": 0,
"metrosDistanciaTotal": 88005,
"metrosDistanciaRetorno": 14522,
"segundosRetorno": 818,
"codigoRota": 3930798,
"numeroRota": 1,
"exportado": true,
"dataExportacao": "2022-04-29T11:08:47.44-03:00",
"atividades": []
}
]
}
.......
How do I formulate my ''jolt''?
output JSON :
{
"rotas": [
{
"nomeRota": "BRAGANÇA PAULISTA",
"placa": "EVQ6280",
"nomeMotorista": "MARCO ANTONIO",
"dataSaida": "2022-05-02T07:00:00-03:00",
"dataChegada": "2022-05-02T13:23:09.6-03:00",
"tipoVeiculo": "VUC",
"documentoTransportadora": "52912748000679",
"codigoTransportadora": "52912748000679",
"custoFrete": 0,
"metrosDistanciaTotal": 88005,
"metrosDistanciaRetorno": 14522,
"segundosRetorno": 818,
"codigoRota": 3930798,
"numeroRota": 1,
"exportado": true,
"dataExportacao": "2022-04-29T11:08:47.44-03:00",
"atividades": []
}
]
}
I need to remove the $id of rotas
Thankss
Solution 1:[1]
You can use remove transformation spec such as
[
{
"operation": "remove",
"spec": {
"rotas": {
"*": { //indices of the "rotas" array
"$id": ""
}
}
}
}
]
the demo on the site http://jolt-demo.appspot.com/ is
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Barbaros Özhan |

