Answers for "c# update value in a json file"

C#
0

c# update value in a json file

string json = File.ReadAllText("settings.json");
dynamic jsonObj = Newtonsoft.Json.JsonConvert.DeserializeObject(json);
jsonObj["Bots"][0]["Password"] = "new password";
string output = Newtonsoft.Json.JsonConvert.SerializeObject(jsonObj, Newtonsoft.Json.Formatting.Indented);
File.WriteAllText("settings.json", output);
Posted by: Guest on December-06-2021

C# Answers by Framework

Browse Popular Code Answers by Language