i have json like this
{\n\t\"username\":\"hunzla\",\n\t\"password\":\"123\"\n}
I want to get value of username "hunzla". How can i get it in c#?
i have json like this
{\n\t\"username\":\"hunzla\",\n\t\"password\":\"123\"\n}
I want to get value of username "hunzla". How can i get it in c#?
use JavascriptSerializer
first step make a class
using System; using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public partial class Userobject
{
[JsonProperty("username")]
public string Username { get; set; }
[JsonProperty("password")]
public long Password { get; set; }
}
//use that class to Deserialize
JavaScriptSerializer js = new JavaScriptSerializer();
BlogSites blogObject = js.Deserialize<Userobject>(jsonData);
string name = blogObject.username ;
string description = blogObject.password ;