Get count of elements in get request

How to get the count(*) of the number of elements returned in json format as a response to the GET request in Postman? is there any functionality is postman gives this info? or any other way to achieve this

Hey @parths1x :wave:

I’m not really understanding what you’re trying to achieve here and how’s it’s going to be used.

The only way you’re going to know what the response of a request will be, is if you send the request.

I’m also unsure of what you are requesting, but I’m going to take a guess that you want to count the number of elements in the response.

If the API doesn’t return this information natively, then you can use the the tests tab to parse the response and do the calculation using standard JavaScript methods and then log it to the console or save it to a variable to be used in a test.

If this is the case, please share an example response as how you count elements will be based on the structure of the response.

Please use the preformatted text option in the editor if you post code or JSON as this will prevent everything from being aligned to the left and hard to read.

Please don’t use screenshots.

If this is not what you want, please can you have an attempt at re-phrasing your question?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.