I am trying to read and update a JSON array from a file. But i am getting this error while trying to update the value of a property. - Property or indexer cannot be assigned to “--” it is read only
Here's my code -
var referenceFile = @"TestData\report.json";
var json1 = File.ReadAllText(referenceFile);
JArray jsonArray = JArray.Parse(json1);
JObject array = JObject.Parse(jsonArray[0].ToString());
foreach (var item in array)
{
var x = item.Value;
item.Value = "test"; // Error
}
My question is how can i update the JSON. this is the json file i need to update.
[
{
"description": "",
"elements": [
{
"description": ""
],
"id": "",
"keyword": "Feature",
"line": 1,
"name": "Validate data via DB Connection",
"uri": "dbtest/DB_Query.feature"
}
]