Skip to content

Make Selenium Easy

And Keep It That Way

  • Home
  • Share
  • Toggle search form

Postman Tutorial Part 43 – Create Parameterized Request by Reading Data From JSON in Postman

Posted on 04/23/2025 By admin

As a part of End to End API Manual and Automation Testing using Postman Series , in this post, we will see how can we read data from an external JSON file in Postman.

In previous post, we have learnt how to read data from a csv file in Postman. Many steps will be similar for JSON file as well . We will see step by step to read data from a json file in Postman here. I will strongly recommended you to go through previous post to understand need of reading data from an external file and example API.

We need to create a JSON file in specific format so that Postman can read it. It must be a JSON Array of JSON Objects. An example is as below:-

[
  {
    "username": "admin",
    "password": "admin"
  }
]

We know a JSON is key-value pair. Key will be used as a variable name in Postman and values of key will be used by Postman to evaluate. We can use key as variable like any other variable in Postman. For ex:- {{keyName}}. At run time, value of key will be used.

So for the example API, we will create a JSON file. I will keep key names similar to fields in request body for better understanding and readability.

[
  {
    "firstname": "Jim",
    "lastname": "Brown",
    "totalprice": 111,
    "depositpaid": true,
    "checkin": "2018-01-01",
    "checkout": "2019-01-01",
    "additionalneeds": "Breakfast"
  }
]

You can create a JSON file using any online editor. After creating json file, save it with .json extension.

Now all steps are similar to previous post. There is no change.

Remember we can use json variables in URL, headers, request , scripts etc as well. Here we are using in request body.

Using variables from json file is same as any variable from Environment, global or collection i.e. as {{variableName}}.

Note:- If a variable value is a string type , put variable name in double quotes. If it is number type or boolean , put it without double quotes. See examples below:-

If we are reading data from a json/csv, we can not run it as a normal request by clicking on “Send” button. If we click on Send button to run above request, it will give you error “400 – Bad Request” because it will not able to get values for the variables defined. We have not told Postman where to look for values yet.

So we need to use Collection Runner for this. Save above request in a collection and launch collection runner. You can find all concepts of Collection and Collection Runner on my blog here.

In Collection Runner, you will see a field named “Data” with “Select File”. Here you need to select json file which we created above. Click on “Select File” button and select the json file. You will see after selection, Data File type will automatically show as application/json. You can preview the file.

Now run the collection by clicking on “Run ” button.

You will see Run result of Collection. You can see json request takes values from json file.

Uncategorized

Post navigation

Previous Post: Using Implicit Wait in Selenium WebDriver
Next Post: Why It Is Not Possible To Read Locators From External Sources In Page Factory Of Selenium WebDriver

Related Posts

image – Make Selenium Easy Uncategorized
image – Make Selenium Easy Uncategorized
IFrame – Make Selenium Easy Uncategorized
image – Make Selenium Easy Uncategorized
TestNG Tutorials 60: Dependency in TestNG – Creating Dependency Among Test Methods – DependsOnMethod Uncategorized
TestNG Tutorials 14: Can We Overload Methods In TestNG Class? 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