User Agents

Web browsers and everyday web tech, explained

Sending Arrays with the Postman Chrome Extension

· 6 min read · Extensions

In this article
  1. Understanding the Postman Chrome Extension
  2. How to Send an Array via JSON
  3. Sending Arrays via form-data and x-www-form-urlencoded
  4. Common Problems and Troubleshooting
  5. Comparison: Extension vs. Desktop App
  6. Frequently Asked Questions

Yes, it is possible to send an array using the Postman Chrome extension, provided you format the request body correctly according to the API's expected content type. Most commonly, this is achieved by using the JSON (JavaScript Object Notation) format, where arrays are denoted by square brackets [ ].

Understanding the Postman Chrome Extension

The Postman Chrome extension was designed as a lightweight way to test APIs directly from the browser without needing to launch the full desktop application. While the desktop app offers a more robust suite of tools—including advanced environment variables and complex scripting—the extension provides the core functionality required to send HTTP requests (GET, POST, PUT, DELETE, etc.) and inspect the responses. To send an array, you are essentially manipulating the payload of a request, which is a standard operation in RESTful API development.

When working with arrays in the extension, the most critical factor is the Content-Type header. The server receiving the request must know how to parse the data you are sending. If you send a JSON array but the header is set to text/plain, the server may treat the entire array as a single string rather than a list of items, leading to 400 Bad Request or 500 Internal Server errors.

How to Send an Array via JSON

JSON is the industry standard for transmitting arrays because it is natively supported by almost every modern programming language. In JSON, an array is an ordered list of values. These values can be strings, numbers, objects, booleans, or even other arrays.

To send an array in the Postman extension, follow these steps:

  1. Open the Postman extension and select the POST or PUT method from the dropdown menu.
  2. Enter the target API endpoint URL in the address bar.
  3. Navigate to the Headers tab and add a new key: Content-Type with the value application/json. This tells the server to expect a JSON-formatted body.
  4. Click on the Body tab.
  5. Select the raw radio button.
  6. From the dropdown menu that appears (usually defaulting to Text), select JSON.
  7. In the text area, enter your array. For example, to send a simple list of IDs, you would enter: [101, 102, 103, 104].
  8. If the API expects an object containing an array, format it like this: {"user_ids": [101, 102, 103]}.
  9. Click Send.

Sending Arrays via form-data and x-www-form-urlencoded

Not every API uses JSON. Some legacy systems or specific file-upload endpoints require multipart/form-data or application/x-www-form-urlencoded. Sending arrays in these formats is less intuitive because these standards were not originally designed for complex data structures like lists.

There are three common ways APIs handle arrays in form-based requests:

  • Repeated Keys: The most common method is to repeat the same key multiple times. In the Postman Body tab, under form-data, you would create multiple rows with the exact same key name. For example, if you want to send a list of tags, you would create a row with key tags and value red, and another row with key tags and value blue. The server-side parser then groups these into an array.
  • Bracket Notation: Some frameworks (like PHP or Ruby on Rails) require the key to end with square brackets to explicitly signal an array. In this case, you would name your key tags[]. You would then add multiple rows of tags[], each with a different value.
  • Comma-Separated Values: Some APIs expect a single key with a string of values separated by commas. For example, key: tags, value: red,blue,green. In this scenario, the array is not sent as a formal data structure, but the server splits the string into an array upon receipt.

Common Problems and Troubleshooting

Even when following the correct steps, users often encounter issues when sending arrays. Most of these problems stem from syntax errors or mismatched expectations between the client (Postman) and the server.

1. Syntax Errors in JSON: JSON is extremely strict. A single missing comma or a trailing comma at the end of an array will cause the request to fail. For instance, [1, 2, 3,] is invalid JSON because of the comma after the 3. Ensure all strings are enclosed in double quotes ("), as single quotes are not valid in JSON.

2. Incorrect Content-Type: If you are sending a JSON array but forget to set the Content-Type: application/json header, the server might ignore the body entirely or throw a parsing error. Always verify that the header matches the format of the body.

3. Data Type Mismatches: Ensure the elements within your array match the type the API expects. If the API expects an array of integers [1, 2, 3] but you send an array of strings ["1", "2", "3"], the server may reject the request with a validation error.

4. CORS Issues: Because the Postman extension runs within the browser, it is subject to Cross-Origin Resource Sharing (CORS) policies. If the server you are hitting does not allow requests from the browser extension's origin, the request will be blocked by the browser before it even reaches the server. This is a browser security feature, not a limitation of the array formatting itself.

Comparison: Extension vs. Desktop App

While the extension can handle arrays, it is important to understand when to move to the Postman Desktop application. The extension is a "lite" version and lacks several features that make managing complex arrays easier.

  • Environment Variables: In the desktop app, you can store a JSON array in a variable and reference it using . This allows you to switch between different test arrays (e.g., a small array for smoke tests and a large array for load tests) without manually editing the body.
  • Pre-request Scripts: The desktop app allows you to write JavaScript to dynamically generate arrays. For example, you could write a script to generate an array of 100 random numbers before the request is sent. The extension does not support this level of automation.
  • Better Debugging: The desktop app provides a more detailed console for inspecting exactly what was sent over the wire, which is invaluable when troubleshooting nested arrays or complex objects.

Frequently Asked Questions

How do I send a nested array in Postman?

To send a nested array (an array within an array), use JSON format. You simply place one set of square brackets inside another. For example: [[1, 2], [3, 4]]. Ensure your Content-Type is set to application/json so the server can parse the multi-dimensional structure correctly.

Why is my array being received as a string?

This usually happens because the Content-Type header is missing or set to text/plain. When the server doesn't know the data is JSON, it treats the entire payload—including the brackets—as a literal string. Double-check that your header is set to application/json.

Can I send an array of objects?

Yes, this is a very common pattern in APIs. In the JSON body, you create an array and place JSON objects (curly braces) inside it. Example: [{"id": 1, "name": "Item A"}, {"id": 2, "name": "Item B"}]. This allows you to send a list of complex records in a single request.

Does the Postman extension support sending arrays via GET requests?

GET requests do not have a request body. To send an array in a GET request, you must use query parameters in the URL. This is typically done by repeating the key: ?id=1&id=2&id=3. The server then interprets these repeated keys as an array of values.

What is the difference between [ ] and { } in Postman?

Square brackets [ ] denote an array, which is an ordered list of values. Curly braces { } denote an object, which is a collection of key-value pairs. If you need to send a list, use square brackets; if you need to send a specific entity with properties, use curly braces.