Skip to content

Make Selenium Easy

And Keep It That Way

  • Home
  • Share
  • Toggle search form

Postman Tutorial Part 35 – Extracting Value From JSON Array Response in Postman – JSON Array Parsing in Postman

Posted on 02/08/2025 By admin

In last post, we have already seen Parsing of JSON Object in Postman. You can get API response in JSON Array as well. A JSON Array is an ordered list of values. If JSON response are enclosed within [ ], it is called a JSON Array. If JSON response is enclosed in { }, is called a JSON Object.

You can get a JSON response which contains both JSON Object and JSON Array. You may also get nested JSON Object and Array.

JSON Array Example:-

[
    {
        "bookingid": 8
    },
    {
        "bookingid": 12
    },
    {
        "bookingid": 13
    },
    {
        "bookingid": 14
    },
    {
        "bookingid": 5
    },
    {
        "bookingid": 15
    },
    {
        "bookingid": 4
    },
    {
        "bookingid": 2
    }
]

Index in JSON Array starts from zero and we can iterate it in similar way we iterate an Array in any programming language.

When we hit Booking – GetBookingIds API of RestFul-booker , It gives a JSON Array which contains a list of JSON Objects. Response is similar to what I have given in example above.

When we parse response using pm.response.json() , It automatically gives you data either in JSON Object or JSON Array as returned response. That means if response is in JSON Object, it will parse it as JSON Object and if response is in JSON Array, it will parse it as JSON Array. Actually variables in JavaScript is loosely coupled so you no need to specify exact type of data.

Suppose you parse response as: –

var jsonArrayData = pm.response.json();

To get array length:- jsonArrayData.length

To get value at specific index: – jsonArrayData[index]

If particular index returns a JSON Object, you need to use concepts discussed in previous post. For example as per above JSON Array , it returns a JSON Object which has field named “bookingid”. So to retrieve bookingid at index 2, we need to write code as :- jsonArrayData[2].bookingid

You can also iterate over JSON Array using each() and for loop:-

// Print one by one
jsonArrayData.each(function(bookings){ console.log(bookings.bookingid)
}) // You can use for loop
for(var i =0 ; i 

 
You can import above example collection link from here: -
https://www.getpostman.com/collections/9ea3d6601eaa19e4d2df
Refer basics of API Testing here.
Refer detailed tutorial of Postman here.
More about API Testing in upcoming posts. Stay tuned.
If you have any doubt, feel free to comment below.If you like my posts, please like, comment, share and subscribe.#ThanksForReading
#HappyApiTesting
Uncategorized

Post navigation

Previous Post: API Testing Tutorial Part 1 – What is An API (Application Programming Interface)?
Next Post: Why Do We Require Browser Driver Executable File To Launch A Browser In Selenium WebDriver?

Related Posts

How To Sort List In Ascending & Descending Order Using Java Stream API? Uncategorized
REST Assured Tutorial 14 –RequestSpecification – How the request will look like Uncategorized
March 12, 2019 – Make Selenium Easy Uncategorized
4. Data Structure Programs – Delete Node From Unsorted LinkedList In Java Uncategorized
Advanced Xpath Concept – Method normalize-space & Its Usage Uncategorized
postman tutorials Uncategorized

Recent Posts

  • Getting Started with Selenium 4: What Is New and How to Upgrade from Selenium 3
  • Manual Testing
  • Baby Steps To Become Efficient Selenium-Java Automation Tester
  • Features of Selenium 4.0.0 Release – Java Binding
  • Part 1: Handling Drop-down Created Using SELECT Tag In Selenium

Recent Comments

No comments to show.

Archives

  • April 2026
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • October 2023
  • August 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • May 2022
  • March 2022
  • October 2021
  • April 2021
  • March 2021
  • January 2021
  • December 2020
  • October 2020
  • September 2020
  • August 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • May 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • January 2018

Categories

  • Getting Started
  • Uncategorized

Copyright © 2026 Make Selenium Easy.

Powered by PressBook Masonry Dark