Convert Json to Class in C#
Here it is a sample code to convert json data into Class object.
namespace JsonToClass
{
class Program
{
static void Main(string[] args)
{
var jsonInput = "{ username:'myName',password:'myPass'}";
var data = JsonConvert.DeserializeObject<demo>(jsonInput);
}
}
class demo
{
public string username { get; set; }
public string password { get; set; }
}
}
Hope this will help you and save your time.
Enjoy !!!
:)
No comments:
Post a Comment