Looping over array from captured
See original GitHub issue- get:
url: "/getAllFilesOfUser/{{ username }}"
headers:
Accept: "application/json"
Authorization: "Bearer {{ token }}"
capture:
- json: "$.length"
as: "questionnairesCount"
- json: "$.*.content"
as: "questionnaires"
- log: "Received {{ questionnairesCount }} questionnaires for {{ username }}"
# - log: "BLA BLA {{ questionnaires }}"
- loop:
- log: "LOOP {{ $loopElement }}"
over: "questionnaires"
The over
clause, I couldn’t get it to work with neither questionnaires
, "questionnaires"
or {{ questionnaires }}
The expected results is pretty obvious.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Loop through an array in JavaScript - Stack Overflow
2. Using forEach loop. forEach loop is a modern way to loop through the array. Also, it gives more flexibility and control over...
Read more >Looping Over Array in Go | TutorialEdge.net
In this snippet, we are going to look at how you can quickly loop over an array in Go.
Read more >Looping through arrays in PL/pgSQL | YugabyteDB Docs
Looping over the values in an array without the SLICE keyword. This loop is functionally identical to the FOR var IN loop. However,...
Read more >6.2. Traversing Arrays with For Loops — AP CSAwesome
You can loop through just some of the elements of an array using a for loop. The following code doubles the first five...
Read more >Documentation: 15: 43.6. Control Structures - PostgreSQL
Without SLICE , or if SLICE 0 is specified, the loop iterates through individual elements of the array produced by evaluating the expression...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This was indeed a problem on my side. I couldn’t extract the array from the json via simple capture, but after using a JS processor, it iterates fine.
Thanks for the help!
I’m starting to believe that this is a matter of capture syntax.
I have an array of the following structure:
And I’m trying to get the
content
item from all of them. I’ve tried$..*.content
,$..content
,$..*.content
,$..[*].content
, and so on. I just get the first item, regardless of if there are any more.But if I have a
I can see the more than one element in the array, aka
[{...}, {...}, ...]