All Questions

274
votes
10answers
690907 views

How can I parse JSON with C#?

I have the following code var user = (Dictionary<string, object>)serializer.DeserializeObject(responsecontent); The input in responsecontent is JSON, but it is not properly parsed into a JSON...
51
votes
5answers
16040 views

How to handle both a single item and an array for the same property using JSON.net

I'm trying to fix my SendGridPlus library to deal with SendGrid events, but I'm having some trouble with the inconsistent treatment of categories in the API. In the following example payload taken ...
242
votes
7answers
183302 views

How to implement custom JsonConverter in JSON.NET to deserialize a List of base class objects?

I am trying to extend the JSON.net example given here http://james.newtonking.com/projects/json/help/CustomCreationConverter.html I have another sub class deriving from base class/Interface public ...
523
votes
20answers
435880 views

How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?

I have a simple key/value list in JSON being sent back to ASP.NET via POST. Example: { "key1": "value1", "key2": "value2"} I AM NOT TRYING TO DESERIALIZE INTO STRONGLY-TYPED .NET OBJECTS I simply ...
188
votes
7answers
175193 views

Parse JSON in C#

I'm trying to parse some JSON data from the Google AJAX Search API. I have this URL and I'd like to break it down so that the results are displayed. I've currently written this code, but I'm pretty lo...
328
votes
8answers
232231 views

Deserialize json object into dynamic object using Json.net

Is it possible to return a dynamic object from a json deserialization using json.net? I would like to do something like this: dynamic jsonResponse = JsonConvert.Deserialize(json); Console.WriteLine(j...
46
votes
3answers
18232 views

Deserializing polymorphic json classes without type information using json.net

This Imgur api call returns a list containing both Gallery Image and Gallery Album classes represented in json. I cant see how to deserialize these automatically using Json.NET given that there is no...
30
votes
2answers
3227 views

How can I parse a JSON string that would cause illegal C# identifiers?

I have been using NewtonSoft JSON Convert library to parse and convert JSON string to C# objects. But now I have came across a really awkward JSON string and I am unable to convert it into C# object b...
123
votes
8answers
294222 views

Deserializing JSON data to C# using JSON.NET

I'm relatively new to working with C# and JSON data and am seeking guidance. I'm using C# 3.0, with .NET3.5SP1, and JSON.NET 3.5r6. I have a defined C# class that I need to populate from a JSON stru...
111
votes
5answers
151827 views

Parsing JSON using Json.net

I'm trying to parse some JSON using the JSon.Net library. The documentation seems a little sparse and I'm confused as to how to accomplish what I need. Here is the format for the JSON I need to pars...

Previous Next