p5.js | saveJSON() Function
The saveJSON() function is used to write an object or array of objects as a JSON object to the
.json file. The saving of the file will vary depending on the web browser.
saveJSON( json, filename, optimize )
Parameters: This function accept three parameters as mentioned above and described below:
- json: It is an object or array of objects that will form the contents of the JSON object to be created.
- filename: It specifies the string that is used as the filename of the saved file.
- optimize: It is a boolean value which specifies if the JSON object would be removed of line breaks and spaces before it is written. It is an optional parameter.
The examples below illustrate the saveJSON() function in p5.js:
Online editor: https://editor.p5js.org/