using Newtonsoft.Json.Linq;
//======
Json Write
//======
void WriteJson(){
	JObject jProp = new JObject
	{
		{ "id", "user" },
		{ "name", "Pillar Park" },
	};
	jProp.Add("email", "userpark@userpark.net");
	jProp.Add("country", "Korea (South)");

	JObject jRoot = new JObject(new JProperty("Root", jAttr));

	File.WriteAllText("test.json", jRoot.ToString());
}


//======
Json Read
//======
void ReadJson()
{
	string str = null;
	using (StreamReader sr = new System.IO.StreamReader("test.json"))
	{
		str = sr.ReadToEnd();
		sr.Close();
	}
    //str = File.ReadAllText("test.json");
    
    JObject jRoot = JObject.Parse(str);
    JToken jToken = jRoot["Root"];
    if (jToken["id"] != null)
    {
    	Console.WriteLine(jToken["id"].ToString());
    }
}

 

+ Recent posts