Note that there are some explanatory texts on larger screens.

plurals
  1. POConverting Object to JSON string in c#,WP7
    text
    copied!<p>I am facing problem when am trying to get a JSON string like </p> <p>[{Key:{key:value,key:value,key:value,key:value}, key: [{key:value,key:value,key:value,key:value}]</p> <h2>in C#.</h2> <p>my class structure is like this</p> <pre><code> public class wideeye { public listing listing { get; set; } public listing_images[] listing_images { get; set; } } public class listing { public string category { get; set; } public string city { get; set; } public string country { get; set; } public string created_at { get; set; } public string current_publish_date { get; set; } public string details { get; set; } public string id { get; set; } public string industry { get; set; } public string list_exp_date { get; set; } public string list_price { get; set; } public string list_start_date { get; set; } public string make { get; set; } public string model { get; set; } public string open_bid { get; set; } public string state { get; set; } public string status { get; set; } public string title { get; set; } public string updated_at { get; set; } public string year { get; set; } } public class listing_images { public string created_at { get; set; } public string id { get; set; } public string listing_id { get; set; } public string listing_image_content_type { get; set; } public string listing_image_file_name { get; set; } public int listing_image_file_size { get; set; } public string listing_image_updated_at { get; set; } public string updated_at { get; set; } } } </code></pre> <hr> <h2>and the code is</h2> <pre><code> listing bid1 = new listing { category = "electronics", city = "BBSR" }; listing_images bid2 = new listing_images { created_at = "Instrumentation", id = "10" }; List&lt;listing&gt; obid1 = new List&lt;listing&gt;() { bid1}; List&lt;listing_images&gt; obid2 = new List&lt;listing_images&gt;() { bid2 }; //DataContractJsonSerializer serializer = null; string sJSON = JsonConvert.SerializeObject(obid1); string sJSONw = JsonConvert.SerializeObject(obid2); </code></pre>
 

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