# saveJSON() downloads instead off saving the json file

**URL:** <https://discourse.processing.org/t/savejson-downloads-instead-off-saving-the-json-file/2755>\
**Category:** p5.js\
**Created:** [August 18, 2018, 3:49pm UTC](https://discourse.processing.org/t/savejson-downloads-instead-off-saving-the-json-file/2755 "2018-08-18T15:49:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ville2008](https://avatars.discourse-cdn.com/v4/letter/v/9fc348/32.png) [@ville2008](https://discourse.processing.org/u/ville2008)\
**Post date:** [August 18, 2018, 3:49pm UTC](https://discourse.processing.org/t/savejson-downloads-instead-off-saving-the-json-file/2755/1 "2018-08-18T15:49:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TheWizardBear](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/thewizardbear/32/3552_2.png) [@TheWizardBear](https://discourse.processing.org/u/TheWizardBear)\
**Post date:** [August 18, 2018, 8:01pm UTC](https://discourse.processing.org/t/savejson-downloads-instead-off-saving-the-json-file/2755/2 "2018-08-18T20:01:03Z")

</div>

Yeah, I noticed this too in [this OpenProcessing sketch](https://www.openprocessing.org/sketch/539709) (except with saveStrings()). The only solution I could think of was switching to Processing(.js).

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [September 2, 2018, 9:19pm UTC](https://discourse.processing.org/t/savejson-downloads-instead-off-saving-the-json-file/2755/3 "2018-09-02T21:19:05Z")

</div>

> [@ville2008](#):
>
> use a json file to save how many people have downloaded my program

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.
