saveJSON(file, data)

Encodes an object to a JSON string and saves it to a JSON file. If the given file exists it gets overridden.

Type: function

Parameter(s):

  • file {String | File}:

    The file name or a File instance.

  • data {Object}:

    The object to encode and save in the file.

Returns:

  • {File}:

    The JSON file the data was written to.