How do we actually append a JSON file?

    General discussion

  • Following method is there to append to a file.

    result = JSON.stringify(data);

    return Windows.Storage.FileIO.appendTextAsync(duplicateFile, result);

    This definitely appends result to the file. But it appends after closing bracket ] of the JSON format. So, how do actually append JSON formatted data to the file?


    Monday, April 28, 2014 9:13 PM

All replies

  • Its not the most efficient way but when using FileIO to save JSON, you may need to overwrite the file instead of appending any changes you make to the JSON data.

    folder.createFileAsync("JSON.txt", Windows.Storage.CreationCollisionOption.replaceExisting).then(function (file) {
            FileIO.WriteTextAsync(file, JSON.stringify(all_JSON_data));

    Wednesday, April 30, 2014 6:51 AM