以编程方式在Windows Phone8.1中编辑Json文件

时间:2015-08-30 10:33:14

标签: c# json windows-phone-8.1

{
"DrinksItems": [
    {
        "UniqueId": "Drinks-Item-1",
        "Title": "After Five",
        "ImagePath": "Assets/Drinks/AfterFive.png",
        "Description": "An After Five is a popular shooter that is often ...",
        "Ingredients": "1/2 oz (15ml) coffee liqueur",
        "Alcohol": "8.89",
        "Vodka": false,
        "Gin": false,
        "Whisky": false,
        "Beer": false,
        "Rum": false,
        "Wine": false,
        "Brandy": false,
        "Tequila": false,
        "Favorite": false,
        "Popular": false,
        "Glass": "Shot",
        "Category": "Creamy Sour-Cream drink"
    },

我希望在按钮单击后将更改从false更新为JSON文件中的true。我怎么能这样做?

1 个答案:

答案 0 :(得分:0)

JSON文件没有什么特别之处。您不能像在数据库中那样更新单个值。它只是一个文本文件,所以是的,你必须全部阅读,更新它,并像任何其他文本文件一样保存它。