append to json file code example
Example 1: push json into json
//create object
var myObj = {
"artist" : artist, //your artist variable
"song_name" : title //your title variable
};
//push the object to your array
favorites.push( myObj );
Example 2: add new element to existing json object
json = JSON.stringify(jsObj);
console.log(json)