How can I parse JSON with C#? -


i have following code

var user = (dictionary<string, object>)serializer.deserializeobject(responsecontent); 

the input in responsecontent json, not parsed json object. how should serialize it?

i assuming not using json.net. if case, should try it.

it has following features:

  1. linq json
  2. the jsonserializer converting .net objects json , again
  3. json.net can optionally produce formatted, indented json debugging or display
  4. attributes jsonignore , jsonproperty can added class customize how class serialized
  5. ability convert json , xml
  6. supports multiple platforms: .net, silverlight , compact framework

look @ example below. in example, jsonconvert class used convert object , json. has 2 static methods purpose. serializeobject(object obj) , deserializeobject<t>(string json):

product product = new product(); product.name = "apple"; product.expiry = new datetime(2008, 12, 28); product.price = 3.99m; product.sizes = new string[] { "small", "medium", "large" };  string json = jsonconvert.serializeobject(product); //{ //  "name": "apple", //  "expiry": "2008-12-28t00:00:00", //  "price": 3.99, //  "sizes": [ //    "small", //    "medium", //    "large" //  ] //}  product deserializedproduct = jsonconvert.deserializeobject<product>(json); 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -