user8867917
user8867917

Reputation:

How to Post map data inside ArrayList as form-data by postman

i am Posting a Map data as ArrayList. So i have tried it by Raw body. but i need to post it as Form-Data. I tried it by many ways but i didn't get result. if any one knows the solution, how to do it. please give me solution.

and here is my code belove.

    @Id
    private String id;

    @Field(value = "name")
    private String name;

    @Field(value = "description")
    private String description;

        @Field(value = "attributes")
        private List<Map<String, String>> attributes = new ArrayList<Map<String, String>>();

    this is what i am sending in Body Raw i want to post it by Form-Data

    {
        "name":"Fourth Template",
        "description":"covers most of selected attributes",
        "attributes": [
        {
          "attributeId": "5d4284807748181cbc8a8277",
          "selectedDataSource": "collections"
        },
         {
          "attributeId": "5d4284807748181cbc8a8277",
          "selectedDataSource": "paycom"
        },
         {
          "attributeId": "5d4284807748181cbc8a8277",
          "selectedDataSource": "originations"
        }
      ]
    }

Upvotes: 2

Views: 3060

Answers (2)

Zakir Hussain
Zakir Hussain

Reputation: 384

Instead of posting it as raw data, in postman you've form-data beside raw data, you can post your formData through it.

See the image link for your reference:

Posting a Map data as ArrayList

Upvotes: 3

ToxicArmor
ToxicArmor

Reputation: 1

show your controller method, try add @RequestBody Entity or @RequestBody Map map.

Upvotes: 0

Related Questions