Skip to content

How to extract an integer from an array obtained via jsonpath query? #2642

Closed Answered by jcamiel
meleu-cw asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

Your JSONPath is correct. As you've got an array, you can refine your query with filters. The filter nth can be used in this case:

GET {{BASE_URL}}/loans
HTTP 200
[Captures]
loan_id: jsonpath "$.[?(@.status == 'executed')].id" nth 0

That should be good now!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@meleu-cw
Comment options

Answer selected by meleu-cw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants