saveJSON() downloads instead off saving the json file

i am trying to use a json file to save how many people have downloaded my program but when i use saveJSON it just downloads a file instead off saving the file

Yeah, I noticed this too in this OpenProcessing sketch (except with saveStrings()). The only solution I could think of was switching to Processing(.js).

Are you trying to save that download data on the server? Because saveJSON / saveStrings etc. save data on the client – they aren’t downloading, they are running in the local client web browser and saving to the client. As the homepage says: “p5.js is a JS client-side library”

Typically you wouldn’t use p5.js to count downloads – you would just use server-side statistics, and that depends on your server. Where / how are you hosting the file?

If you want how many people use a sketch that is hosted online (not file downloads), then you probably want to use a network protocol library so that the client sketch can send a +1 ping to some server process or service about the fact it is being run.