Answered
Writing to JSON file
The following code cretes the json file on the desktop but fails to wrtie the obj variable values.
Any ideas why the code wrtitting functionality is not working?
#target photoshop
function createJSONFile(object){
//defie file
var jsonFile = new File("~/Desktop/Test.json")
//jsonFile.close();
if(!jsonFile.exists) {
//open file
jsonFile.open("w")
//write to file convert to string
jsonFile.write(JSON.stringify(object));
//close file
jsonFile.close()
}
}
//object variable
var obj={
compName: "My comp",
width: 1920,
height: 1080,
numLayer: 3
};
createJSONFile(obj);
