How to work with JSON objects and variables in Postman

preview_player
Показать описание
Hey guys, in this short live video I wanted to show you how you can work with objects and variables in Postman.
----

💥 💥💥 Want to learn more about Postman? Check my Postman online course.

▸▸▸ Get it for only $9.99 (limited supply, 75% OFF, first 200 viewers):
Рекомендации по теме
Комментарии
Автор

That's super helpful, I was struggling with passing a JSON object as a variable in Postman and you explained how to use JSON.stringify perfectly. Thank you!

zlurl_
Автор

Excellent video and very informative. I have started using variables for my testing in JSON part of api automation. Your actual course is brilliant.

softwaretestingwithjamil
Автор

Excellent explanation. Thank you and best wishes

alexkobko
Автор

Thank you, man. I was missing the stringify step.

plamenem.dimitrov
Автор

Hi Valentin,
At 6:55 when you set your variable you use pm.environment.set("address", JSON.strinfify (address));
In the postman version I am using there is no strinfify they have stringify.
When I send the request, exactly the same way you wrote it, I get an error Syntax error.
I change the strinfify for stringify and still the same error. I tried curly brackets, parenthesis, same error.
Can you tell me what is the right way to write this variable please. I have the postman version 10.17.1

Thank you

kalamityj
Автор

Thanks mate. Have a great day. Can you share with us how to handle dynamic data I.e take response from one request and user some values for assertion in other response or some values to pass as request in other request

rashmiambedkar
Автор

Nice video
How to create variable to give webapp URL.Is it same like you are giving for a name ??

ramyagopu
Автор

Hi, can we create session for login in postman? is there any way? Thanks...

elmirmahmudov
Автор

hii..can you please explain to post multiple array post request using postman

mounikal
Автор

How do you do this with form-data so you can upload files for example? [Key][value] -> [object][files]?

thegoodhood
Автор

Please Help how to create multi group with array . only use one auth key and create multi group in a account

monikakanathe
Автор

How to write Json response in csv or excel using Test section ?

AkshayGadkariTestEnthusiast
Автор

Hi, I'm trying to add +1 to the value store in a global variable. I tried using the below script but it is just appending the number to the value. Can you please advise on this?


var addressId = pm.globals.get("addressId");
console.log(addressId); //value stored in "addressId" = 24556
var addressIdDeleted = add(addressId, 1);
// Value in "addressIdDeleted" should be 24557 but it is getting displayed as 245561


pm.test("Address is deleted", function () {
var jsonData = pm.response.json();

});


But for the below code the value for 'b' is displayed as expected as 4.
/*var a = 3;
var b = a + 1;
console.log(b);*/


Though i tried in the same way, it doesn't work for me in the above scenario.

nithyaraji
Автор

anyone clear me - how to update same id in JSON FORMAT FILE using SQL

naseestech
Автор

Can you tell me what is meaning of "createdAt": "2020-06-17T18:19:56.746Z" ? please help me

md.mahfuzulhuqtalukder
Автор

I did your example and I have also a little training_mysql -database in my computer. If I give with postman
{
"name": "JSON User",
"phone":"536345543",
"street": "JSON Street 777",
"number": "4455",
"zipcode":"753563"
}
All went well and data is stored to database --> OK

Second test with Postman (var address -part included): I can see from the Console Log that request body is ok (all values are there) but fields street, number and zipcode are empty (NULL) in database. Does variable "var address" need some more brain to "Pre-request script" -part?
body
{
"name": "JSON User",
"phone":"536345543",
"address":{{address}}
}

Pre-request script
var address = {
"street": "JSON Street 777",
"number": "4455",
"zipcode":"753563"
}
pm.environment.set("address", JSON.stringify(address));

kaipenttila