I need to make a GET request to a method that contains Dictionary as a parameter. I browse through but could not find any kinds of information about how I could send Dictionary so my request hit to my method. Method signature is as like as below
public void AddItems(Dictionary<string,object> Items)
Best Regards,
Kemal
Did you read ASP.NET Wire Format for Model Binding to Arrays, Lists, Collections, Dictionaries
You Can Use Dictionary As A Parameter In This Way:
I wrote a ModelBinder that does exactly what you wanted:
More explanations and full post you can see in my blog:
Json To Dictionary generic model binder
If you have problems receiving Dictionary in your webApi controller, relatively painless solution is to switch the parameter to List<"ObjectRepresentingDict"> insetead. It will map automatically.