Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Convert JSON String into List of <objects>........in windows Phone 7?
    text
    copied!<p>I am getting data from my web service into a JSON string in a file named PreGroup.cs.</p> <p>In that file I have a object of web service Reference.</p> <p>Now there is also definitely a method in that PreGroup.cs file and that is:</p> <pre><code>public string LoadAllArticles() { try { //articles_list = null; obj = new GBService.PreGroupbookSreviceSoapClient(); obj.LoadAllArticlesCompleted += (obj_LoadAllArticlesCompleted); obj.LoadAllArticlesAsync(); obj.CloseAsync(); } catch (Exception) { throw; } //This is string which will be passed to the caller of this method. return articles_list; } </code></pre> <p>and here is the load:</p> <pre><code>void obj_LoadAllArticlesCompleted(object sender, GBService.LoadAllArticlesCompletedEventArgs e) { try { articles_list = e.Result.ToString(); } catch (Exception Ex) { throw Ex; } MessageBox.Show("Welcome to Groupbook &lt;/br&gt;" + AllArticleData); obj.LoadAllArticlesCompleted -= (obj_LoadAllArticlesCompleted); } </code></pre> <p>Now when I call this method in my windows phone's page "Index.cs" where I want to load all the articles, I am unable to convert that simple string back to the List.</p> <p>Here is me code of the Index.cs class where I have tried <strong>many</strong> things to deserialize/ parse/etc but I am unable to convert that string into List:</p> <pre><code>private void LoadArticles() { obj = new PreGroupbook(); string art= obj.LoadAllArticles(); // How to convert that string into List&lt;GB_articles&gt; ?????? I have several ways MyArticles.ItemsSource = gb_li; } </code></pre> <p>And here is the string which I want to deserialize:</p> <pre><code>[{ "article_id": 1, "article_title": "This is Test Article", "created_timestamp": "\/Date(1346395093347)\/", "modified_timestamp": null, "article_category_id": 3, "privacy_id": 1, "subscribers_count": 51, "votes_down_count": 21, "article_tag": "My Best C++", "votes_up_count": 42, "isActive": true }, { "article_id": 2, "article_title": "The flying Horse was seen", "created_timestamp": "\/Date(1346395104223)\/", "modified_timestamp": null, "article_category_id": 3, "privacy_id": 1, "subscribers_count": 51, "votes_down_count": 21, "article_tag": "My Best C++", "votes_up_count": 42, "isActive": true }, { "article_id": 3, "article_title": "iWatch is just amazing", "created_timestamp": "\/Date(1346395105477)\/", "modified_timestamp": null, "article_category_id": 3, "privacy_id": 1, "subscribers_count": 51, "votes_down_count": 21, "article_tag": "My Best C++", "votes_up_count": 42, "isActive": true }, { "article_id": 4, "article_title": "Oh My My....did you see that???", "created_timestamp": "\/Date(1346395107890)\/", "modified_timestamp": null, "article_category_id": 3, "privacy_id": 1, "subscribers_count": 51, "votes_down_count": 21, "article_tag": "My Best C++", "votes_up_count": 42, "isActive": true }] </code></pre> <p>What am I doing wrong?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload