Tharindu Senanayake Tharindu Senanayake - 6 months ago 20
JSON Question

Passing Multiple Json data to a list or an array in Web Api controller

I'm trying to pass an Json array to a web api and get all that values to a single array or a list in the web api.

to test this I'm using Postman app in Google. This is my input data

[{
"ID":"1",
"ID":"2",
"ID":"3"
}]


What I want is to pass these data to a post method and get all these data into a single array or a list. How can I do this?

I need to execute the following query

Select * from table where ID in ("I need the data list here");


To do that I have to get all the data sent to from the json to a single array or a list.

Answer

{} = json object. [] = json array. you are passing a json array with one object in it

[
{"ID":"1"},
{"ID":"2"},
{"ID":"3"}
]