I've the following property
{
"bad":
{
"Login": "someLogin",
"Street": "someStreet",
"House": "1",
"Flat": "0",
"LastIndication":
[
"230",
"236"
],
"CurrentIndication":
[
"263",
"273"
],
"Photo":
[
null,
null
]
}
}
and how can I rename this from 'bad' to 'good' for example. Yes, I saw the extension method by Abi Bellamkonda
public static class NewtonsoftExtensions
{
public static void Rename(this JToken token, string newName)
{
var parent = token.Parent;
if (parent == null)
throw new InvalidOperationException("The parent is missing.");
var newToken = new JProperty(newName, token);
parent.Replace(newToken);
}
}
but it got this exeption
See Question&Answers more detail:osCan not add Newtonsoft.Json.Linq.JProperty to Newtonsoft.Json.Linq.JProperty.