0

I've got a JSON like that:

[
{
"accID": "3asdasd321asdasdfsadf2",
"test": "one",
"isGood": "true",
},
{
"accID": "Not Found",
"test": "two",
"isGood": "true",
},
{
"accID": "1asdasd121asdasdfsadf5",
"test": "five",
"isGood": "false",
}
]

And I want to get all of the accID values, but excludeing 'Not Found' values, like an example:

[
"3asdasd321asdasdfsadf2",
"1asdasd121asdasdfsadf5"
]

I just can't figure out how to setup a filter.

.accID returns all of accID values in the needed format, but obviously 'Not Found' is included.

$.[?(@.accID != 'Not Found')] - this one returns the almost the same original JSON. 'Not Found' is excluded from that, but I need only accID's.

I thought that this filter should work $.accID[?(@.accID != 'Not Found')] , but it doesn't.

Could someone please tell me the correct filter to get values just like an example?

1 Answers1

1

I found an answer:

$.[?(@.acc != 'Not Found')].acc

Thanks anyway.