基于Key更新单个JSON值

时间:2016-05-26 04:30:50

标签: c# json

专家,

我有一个关于更新特定值的问题,而不是基于JSON文件的索引路径。例如,使用下面的JSON,对于第一组业务,我想基于另一个值更新“SubscribeStatus to”true“,如Key”ID“的”1“值。这是可能的,我将如何实现此?

高级逻辑:

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",
  },
]
}

0 个答案:

没有答案