csharp convert object to json
Code Example - csharp convert object to json
var jsonString = JsonConvert.SerializeObject(ObjectModel);
object to json csharp
using Newtonsoft.Json;
var jsonString = JsonConvert.SerializeObject(obj);
csharp json to dictionary
string json = @"{""key1"":""value1"",""key2"":""value2""}";
var values = JsonConvert.DeserializeObject<Dictionary<string, string>>(json);
csharp dictionary to json
return JsonConvert.SerializeObject( myDictionary );
deserialize object to dictionary csharp
string json = @"{""key1"":""value1"",""key2"":""value2""}";
var values = JsonConvert.DeserializeObject<Dictionary<string, string>>(json);
csharp object to json string
Newtonsoft.Json.JsonConvert.SerializeObject(new {foo = "bar"})
string to json csharp
JObject json = JObject.Parse(str);
string json to class csharp
var result = JsonConvert.DeserializeObject<YourClass>(jsonstring);