json.net jobject replace value
JObject json= JObject.Parse(jsonString); JArray entityTypeDtos= (JArray)json["EntityTypeDto"]; foreach(var e in entityTypeDtos) { if(e["Language"] != null) e["Language"]="EN"; }
Here is what the above code is Doing:
1. Parse the json string into a JObject
2. Get the JArray of EntityTypeDto
3. Iterate through the JArray and set the Language property to “EN”
4. Serialize the JObject back to a string