0

Experts,

I have a question regarding updating a specific value not based on the index path of the JSON file. For example with the JSON below, with the first set of businesses, I want to update "SubscribeStatus to "true" based on another value like the "1" value of the Key "ID". Is this possible, and how would I achieve this?

High Level Logic:

if (ID == 1)
    SubscribeStatus (for first set of businesses) = true

if (ID == 2)
    SubscribeStatus (for second set of businesses) = false

JSON:

{"Business":
[
   {
    "ID": 1,
    "Name_Location": "A Name Location",
    "Brief_Name_Location": "A Brief Name Location",
    "Full_Address": "A Address",
    "Latitude": 0.0,
    "Longitude": 0.0,
    "Phone": 123456789,
    "Website": "www.google.com",
    "SubscribeStatus":false,
    "Logo": "Alogo.png",
  },
   {
    "ID": 2,
    "Name_Location": "B Name Location",
    "Brief_Name_Location": "B Brief Name Location",
    "Full_Address": "B Address",
    "Latitude": 1.0,
    "Longitude": 1.0,
    "Phone": 987654321,
    "Website": "www.yahoo.com",
    "SubscribeStatus":true,
    "Logo": "Blogo.png",
  },
]
}
pkozlowski
  • 71
  • 7
  • 2
    Possible duplicate of [How to update a property of a JSON object using NewtonSoft](http://stackoverflow.com/questions/22853066/how-to-update-a-property-of-a-json-object-using-newtonsoft) – M.Babcock May 26 '16 at 04:33
  • you ohave this tagged with C#, so you want to do this in C#? Or Javascript? If C#, deserialize the json into an enumerable of your object, and then modfy there. – Jonathan May 26 '16 at 04:44

0 Answers0