Sending an array as form-data

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

This is not working for me.

I am only getting the last value in my_array.

Kindly assist.

1 Like

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?

Thanks for the reply.

I am using Laravel Lumen for the API.

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

Thanks for the assist. Let me investigate.

Cheers!

make sure you put in your key ex. my_array …

1 Like

{
“Product_Reviews”:[
{“Customer_Name”:“Fakhar”,
“Customer_Description”:“Some Desciption”}
]

}

// Use this Format

use key[]: value

1 Like

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. :slightly_smiling_face:

Ty good sir. That was the point.

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