Krunal
Krunal

Reputation: 6490

Get and display json data in windows phone

I have developed many apps for iOS, now i want to learn Windows phone development.

In windows phone i want to display data in my listView

I want to display this json data in my ListView,

      {
        "Event_Id":2673,
        "Event_Name":"Bruno Mars",
        "Event_Navigateurl":"bruno-mars",
        "IphoneImage":"http://mywebsite/images/6349764112819brunomars_34628_1_1_20130227170016.jpg",
        "Price":38.5,
        "SubCategory":"Rock and Pop",
        "SubCategoryURL":"rock-and-pop",
      },
     {

        "Event_Id":752,
        "Event_Name":"One Direction",
        "Event_Navigateurl":"one-direction",
        "IphoneImage":"http://mywebsite/images/634848503231825onedirection_34537_1_1_20110926162229.jpg",
        "Price":10,
        "SubCategory":"Rock and Pop",
        "SubCategoryURL":"rock-and-pop",
    },
   {
       . . . 
   }

Can any one suggest, how to display this json data from URL.

Please help i am new in Windows phone.

Thanks in advance.

Upvotes: 0

Views: 2937

Answers (1)

Nikhil Prajapati
Nikhil Prajapati

Reputation: 942

please refer my Question. i had same query to bind the json data in listbox. so, Please refer this link.

How to bind Json data in windows phone

I hope you get the Solution of your query.

And for getting the json data from url. for that refer this code.

Public MyJson()
{
   String myUrl = "Your WebService URL";
   WebClient wc = new WebClient();
   wc.DownloadStringAsync(new Uri(myUrl), UriKind.Relative);
   wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted);
}

private void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
   var myData = e.Result;
   // You will get you Json Data here..
}

And finally you will get your Json Data Easily.

Upvotes: 2

Related Questions