using (System.IO.StreamReader file = System.IO.File.OpenText(jsonfile))
{
using (JsonTextReader reader = new JsonTextReader(file))
{
try
{
JToken token = JToken.ReadFrom(reader);
JObject o = (JObject)token;
var conections = o["MsSql"];
var arrconnection = conections.ToArray();
foreach (JToken item in arrconnection)
{
connectionJPropertyList.Add(item as JProperty);
}
foreach (var item in token)
{
if ((item as JProperty).Name != "MsSql")
{
JsonStringList.Add(item as JProperty);
}
}
}
catch (Exception ex)
{
return;
}
}
}

 

 

 

string str = JsonConvert.SerializeObject(jo, Newtonsoft.Json.Formatting.Indented);
File.WriteAllText(jsonfile, str, System.Text.Encoding.UTF8);