I have a restful wcf service URI like below
http://localhost:8090/WCFRestService.RestServices.svc/1/brands
It's a GET method and return a list of products brands by passing product category ID in JSON format as below:
[
{
"CategoryId": 1,
"BrandId": 1,
"Name": "ABC"
},
{
"CategoryId": 1,
"BrandId": 2,
"Name": "DEF"
},
{
"CategoryId": 1,
"BrandIdId": 3,
"Name": "GHI"
},
{
"CategoryId": 1,
"BrandIdId": 4,
"Name": "JKL"
},
{
"CategoryId": 1,
"BrandIdId": 5,
"Name": "MNO"
},
{
"CategoryId": 1,
"BrandIdId": 6,
"Name": "PQR"
},
{
"CategoryId": 1,
"BrandIdId": 7,
"Name": "STU"
}
]
I want to bind all these brand names from the json data to a dropdownlist in ASP.Net web application built in .Net 3.5 version. What I have done so far is below:
WebClient proxy = new WebClient();
byte[] abc = proxy.DownloadData((new Uri("http://localhost:8090/WCFRestService.RestServices.svc/1/brands")));
Stream strm = new MemoryStream(abc);
DataContractSerializer obj = new DataContractSerializer(typeof(string));
After this I am unable go further. Can anyone help me out to deserialize and bind it to my dropdownlist? Thank in advance.