1
votes

I am trying to create a Json Extractor and it`s being a thought activity. I have this json structure:

[  
 {  
  "reportType":{  
     "id":3,
     "nomeTipoRelatorio":"etc etc etc",
     "descricaoTipoRelatorio":"etc etc etc",
     "esExibeSite":"S",
     "esExibeEmail":"S",
     "esExibeFisico":"N"
  },
  "account":{  
     "id":9999999,
     "holdersName":"etc etc etc",
     "accountNamber":"9999999",
     "nickname":null
  },
  "file":{  
     "id":2913847,
     "typeId":null,
     "version":null,
     "name":null,
     "format":null,
     "description":"description",
     "typeCode":null,
     "size":153196,
     "mimeType":null,
     "file":null,
     "publicationDate":"2018-12-05",
     "referenceStartDate":"2018-12-05",
     "referenceEndDate":"2018-12-06",
     "extension":null,
     "fileStatusLog":{  
        "idArquivo":2913847,
        "dhAlteracao":"2018-12-05",
        "nmSistema":"SISTEMA X",
        "idUsuario":999999,
        "reportStatusIndicador":"Z"
     }
  }
 }
]

What I need to do: First of all, I am using the option "Compute concatenation var" and "Match No." as -1. Because the service can bring in the response many of those.

I have to verify, if "reportStatusIndicador" = 'Z' or 'Y', if positive, I have to collect File.Id OR file.FileStatusLog.idArquivo, they are the same, I was trying the first option, in this case the number "2913847", but if come more results, I will collect all File.id`s

With this values in hands, I will continue with a for each for all File.id`s.

My last try, was this combination, after reading a lot and tried many others combinations.

[?(@...file.fileStatusLog.reportStatusIndicador == 'Z' || @...file.fileStatusLog.reportStatusIndicador == 'Y')].file.id

But my debug post processor always appears like this, empty: filesIds=

2

2 Answers

2
votes

Go for $..[?(@.file.fileStatusLog.reportStatusIndicador == 'Z' || @.file.fileStatusLog.reportStatusIndicador == 'Y')].file.id

Demo:

enter image description here

References:

1
votes

I could do it with this pattern:

[?(@.file.fileStatusLog.reportStatusIndicador == 'Z' || 
@.file.fileStatusLog.reportStatusIndicador == 'Y')].file.id

filesIds_ALL=2913755,2913756,2913758,2913759,2913760,2913761,2913762,2913763,2913764,2913765,2913766,2913767,2913768,2913769,2913770