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?

0

1 Answer 1

1

I found an answer:

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

Thanks anyway.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.