Postman nested form-data

Postman Nested form-data

To send nested form-data in Postman, you can use the key-value pairs where the value is again a nested form-data. This allows you to structure your data in a hierarchical manner, similar to nesting objects in JavaScript or JSON.

Here’s an example to demonstrate how to send nested form-data in Postman:

Let’s say you have an API endpoint `/users` that accepts the following nested form-data parameters:

  • `name`: The name of the user (string).
  • `age`: The age of the user (number).
  • `address`: An object representing the user’s address, with the following properties:

    • `street`: The street name (string).
    • `city`: The city name (string).
    • `country`: The country name (string).

In Postman, you can create the nested form-data by adding multiple key-value pairs with the same key and different sub-keys. Here’s how the form-data should be structured:

  1. Add a key-value pair for the `name` parameter:

    • `Key`: name
    • `Value`: {user’s name}
  2. Add a key-value pair for the `age` parameter:

    • `Key`: age
    • `Value`: {user’s age}
  3. Add a key-value pair for the `address` parameter:

    • `Key`: address[street]
    • `Value`: {user’s street}
    • `Key`: address[city]
    • `Value`: {user’s city}
    • `Key`: address[country]
    • `Value`: {user’s country}

After adding the key-value pairs, send the request to the API endpoint `/users` and it will receive the nested form-data with the provided values.

Leave a comment