object to json c#
using Newtonsoft.Json;
var jsonString = JsonConvert.SerializeObject(obj);
object to json c#
using Newtonsoft.Json;
var jsonString = JsonConvert.SerializeObject(obj);
string json to class c#
var result = JsonConvert.DeserializeObject<YourClass>(jsonstring);
c# json convert
jsonString = File.ReadAllText(fileName);
weatherForecast = JsonSerializer.Deserialize<WeatherForecast>(jsonString);
c# object to json string
Newtonsoft.Json.JsonConvert.SerializeObject(new {foo = "bar"})
string json to object c#
var resultCon = JsonConvert.DeserializeObject<Dictionary<string, string>>(jsonStr);
//or
string json = "{\"ID\": 1, \"Name\": \"Abdullah\"}";
User user = JsonConvert.DeserializeObject<User>(json);
/*
public class User
{
public int ID { get; set; }
public string Name { get; set; }
}
*/
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us