You can send an array in form-data by using the same name for multiple keys, and putting values in each one. Please see the screenshots below for examples (substitute my_array
for any name you want):
In Bulk Edit mode:
In Key-Value Edit mode:
To test it out, you can try sending a POST request to https://postman-echo.com/post , and check the response:
1 Like
nwaweru
(Ndirangu Waweru)
October 24, 2019, 11:29am
2
This is not working for me.
I am only getting the last value in my_array.
Kindly assist.
kwoque
(Kwok-Ho Lam)
October 24, 2019, 11:04pm
3
I think it depends on how your own API what you receive. in my case I use .NET to receive an object DTO from the body which contains a property string[]
What language do you use to receive the POST?
nwaweru
(Ndirangu Waweru)
October 25, 2019, 9:51am
4
Thanks for the reply.
I am using Laravel Lumen for the API.
kwoque
(Kwok-Ho Lam)
October 25, 2019, 12:01pm
5
I have found this post which said that this is a way to convert KeyValue pairs from JSON into an array. PHP is not my thing, maybe someone else can help you further.
see: https://stackoverflow.com/questions/7047870/issue-reading-http-request-body-from-a-json-post-in-php
Cheers
$input = json_decode($inputJSON, TRUE); //convert JSON into array
nwaweru
(Ndirangu Waweru)
October 25, 2019, 1:31pm
6
Thanks for the assist. Let me investigate.
Cheers!
boonlenar
(Arnel Digal)
January 19, 2020, 7:15am
7
make sure you put in your key ex. my_array …
1 Like
{
“Product_Reviews”:[
{“Customer_Name”:“Fakhar”,
“Customer_Description”:“Some Desciption”}
]
}
// Use this Format
arlem
(Arlémi Turpault)
March 22, 2021, 9:15am
10
If you aren’t sure how this works, check the following collection:
https://www.postman.com/postman/workspace/postman-answers/collection/9215231-2d7409b9-8b19-4a79-a6aa-fe616702d200?ctx=documentation
You can also fork it to your Postman account to try it yourself.
luis.uria
(Luis Uria)
May 5, 2021, 12:14pm
11
Ty good sir. That was the point.
moorthiraj
(Moorthi Raj)
June 13, 2021, 11:57am
12
Actually I was trying to upload the media file in the array list. Initially I have done that before and then when I searched I found the solution from here
Hi, is it possible to send an empty array? I tried, but it is not working for me…
You can send an array in form-data like below
1 Like