Search

Use ArrayList and HashMap for repeated responses.

Declare the Response variable, and the repeated Json object array utilizes loop statements, ArrayList, and HashMap blocks.

Declare the response to be received by calling the API as a single variable called response.
If there is an array of Json objects that are repeated in this response value, first declare ArrayList and HashMap variables before executing the loop.
And, add the hashmap key and value to be included in the ArrayList variable through the Foreach statement using the Add Array(HashMap) Variable block.
Finally, if you assign this list to the response variable, you can conveniently check the response value in the Json object array format.
Below is the example of working with similar logic to the previous example without variable declarations and loops.
The result may be similar, but there is a significant difference from the previous example in code readability and block rendering.
The key to building an API is its architectural design.
In the process of calling the API and receiving response data, the logic should be configured to reduce the load on the system and reuse the code.