using Newtonsoft.Json;
string josnString = File.ReadAllText(FilePath, Encoding.Default);
JObject jo = JObject.Parse(josnString);
jo.Add("key", "value");
File.WriteAllText(@"c:\videogames.json", videogameRatings.ToString());
JObject videogameRatings = new JObject(
new JProperty("Halo", 9),
new JProperty("Starcraft", 9),
new JProperty("Call of Duty", 7.5));
File.WriteAllText(@"c:\videogames.json", videogameRatings.ToString());
// write JSON directly to a file
using (StreamWriter file = File.CreateText(@"c:\videogames.json"))
using (JsonTextWriter writer = new JsonTextWriter(file))
{
videogameRatings.WriteTo(writer);
}