Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postman - How can I pass array as variable

Tags:

postman

Is there the possibility to use an array variable inside postman?

e.g. inside the body of a request:

{
    "myData" : {{arrayVariable}}
}

and inside the data file:

{
    "arrayVariable": ["1", "2", "3"]
}
like image 777
Nirmal Dholakiya Avatar asked Nov 11 '16 16:11

Nirmal Dholakiya


2 Answers

It's possible, you can even add your own keys

enter image description here

like image 73
mpalencia Avatar answered Oct 12 '22 22:10

mpalencia


You can create a JSON body like this:

{
    "myData" : [
        {{arrayVariable}}
    ]
}

And the variable like this:

arrayVariable: "1", "2", "3"

where arrayVariable is the key and "1", "2", "3" is the value.

like image 5
MickJaggerr Avatar answered Oct 12 '22 23:10

MickJaggerr