Related questions
How do I turn a C# object into a JSON string in .NET?
I have classes like these:
class MyDate
{
int year, month, day;
}
class Lad
{
string firstName;
string lastName;
MyDate dateOfBirth;
}
And I would like to turn a Lad object into a JSON string like this:
{
"firstName":"Markoff",
"lastName":"Chaney",
"dateOfBirth":
{
"year":"1901",
"…
Deserialize JSON into C# dynamic object?
Is there a way to deserialize JSON content into a C# 4 dynamic type? It would be nice to skip creating a bunch of classes in order to use the DataContractJsonSerializer.
How to deserialize a JObject to .NET object
I happily use the Newtonsoft JSON library.
For example, I would create a JObject from a .NET object, in this case an instance of Exception (might or might not be a subclass)
if (result is Exception)
var jobjectInstance = JObject.FromObject(…