I've this JSON
{
"found": true,
"consultado": "00000000",
"nome": "EMPRESA DE CNPJ 00000000 LTDA",
"participacaoEmpresa": [
{
"cnpj": "44444444",
"nome": "EMPRESA DE CNPJ 44444444 LTDA",
"descricaoCargo": "Sócio"
},
{
"cnpj": "123",
"nome": "EMPRESA DE CNPJ 123 LTDA",
"descricaoCargo": "Sócio123"
}
]
}
I've maded this JOLT
[
{
"operation": "shift",
"spec": {
"consultado": "DOCT_SCIO",
"nome": "NOME_SCIO",
"participacaoEmpresa": {
"*": {
"cnpj": "CNPJ_PSSA_JUDC",
"nome": "NOME_PSSA_JUDC",
"descricaoCargo": "DCRC_CRGO"
}
}
}
},
{
"operation": "shift",
"spec": {
"*_PSSA*|DCRC_CRGO": {
"*": {
"@": "[&1].&2"
}
}
}
}
]
But I've this output
[ {
"DCRC_CRGO" : "Sócio",
"CNPJ_PSSA_JUDC" : "44444444",
"NOME_PSSA_JUDC" : "EMPRESA DE CNPJ 44444444 LTDA"
}, {
"DCRC_CRGO" : "Sócio123",
"CNPJ_PSSA_JUDC" : "123",
"NOME_PSSA_JUDC" : "EMPRESA DE CNPJ 123 LTDA"
} ]
But I need this
[ {
"DOCT_SCIO": "00000000",
"NOME_SCIO": "EMPRESA DE CNPJ 00000000 LTDA",
"DCRC_CRGO" : "Sócio",
"CNPJ_PSSA_JUDC" : "44444444",
"NOME_PSSA_JUDC" : "EMPRESA DE CNPJ 44444444 LTDA"
}, {
"DOCT_SCIO": "00000000",
"NOME_SCIO": "EMPRESA DE CNPJ 00000000 LTDA",
"DCRC_CRGO" : "Sócio123",
"CNPJ_PSSA_JUDC" : "123",
"NOME_PSSA_JUDC" : "EMPRESA DE CNPJ 123 LTDA"
} ]
What I've maded wrong here and I need to change?
If you could help me, do a pass by pass or explain details, please.
I'm having problem to understand my mistakes and I've tryied much codes to get the needed output.
The JOLT documentation is confused.
Attached at question
Need to transfer the values
DOCT_SCIOandNOME_SCIOinto the innermost part of the JSON from the two upper levels, so use@2,DOCT_SCIOand@2,NOME_SCIOas in the following case :