Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Compressing the json file size. LOTS of really long scripts.
- Nimbus-2007
-
Scratcher
19 posts
Compressing the json file size. LOTS of really long scripts.
I am trying to share a project of mine that I have been working on for quite a while, and I really want to add cloud variables to it. I am aware that there is a hard 5 MB limit for json files, but I had no idea that I would hit it (slightly due to working in turbowarp the entire time). Apparently the json file for the project was sitting at a cool 7.4 MB. Yikes.
However, after checking my files, I noticed a smaller, 0.7 MB “compressed” file size. Is there any way for me to compress the json way down to the number shown, or to upload the compressed size instead of the full size? (that sounds impossible, but hey, I'm desperate). Otherwise, is there a json compressor I can use to make life easier?
I tried a couple of json file compressors, but nothing seems to work for a scratch project.
If nothing is possible, I could very well just convert it to javascript and publish it somewhere else, but I want it to be on scratch if possible.
Also, a side note, the project I have been working in is basically just a demo, the full thing will probably be twice the size (maybe more if I decide to add more). I now it's ambitious, but could the file be compressed to the point of the full project being within 5 MB?
Any input is much appreciated, and I am open to the flat out answer of no.
However, after checking my files, I noticed a smaller, 0.7 MB “compressed” file size. Is there any way for me to compress the json way down to the number shown, or to upload the compressed size instead of the full size? (that sounds impossible, but hey, I'm desperate). Otherwise, is there a json compressor I can use to make life easier?
I tried a couple of json file compressors, but nothing seems to work for a scratch project.
If nothing is possible, I could very well just convert it to javascript and publish it somewhere else, but I want it to be on scratch if possible.
Also, a side note, the project I have been working in is basically just a demo, the full thing will probably be twice the size (maybe more if I decide to add more). I now it's ambitious, but could the file be compressed to the point of the full project being within 5 MB?
Any input is much appreciated, and I am open to the flat out answer of no.
- PointerOS_software
-
Scratcher
35 posts
Compressing the json file size. LOTS of really long scripts.
Umm… Scratch is based on Javascript right? My projects have exceeded 40 MB in file size. I'm not sure what you mean, as scratch supports file sizes upto 70MB. Are you trying to implement savecodes or something?
- Spentiline
-
Scratcher
100+ posts
Compressing the json file size. LOTS of really long scripts.
Load your project and reset any lists or variables you can reset. It's quite common for variables / lists to contain huge amounts of unnecessary data.
Umm… Scratch is based on Javascript right? My projects have exceeded 40 MB in file size. I'm not sure what you mean, as scratch supports file sizes upto 70MB. Are you trying to implement savecodes or something?No, the project.json file can go up to 5 MB uncompressed and each asset has a maximum size of 10 MB.
- PointerOS_software
-
Scratcher
35 posts
Compressing the json file size. LOTS of really long scripts.
Load your project and reset any lists or variables you can reset. It's quite common for variables / lists to contain huge amounts of unnecessary data.Well, when I checked mine, it said it was 40 MB.Umm… Scratch is based on Javascript right? My projects have exceeded 40 MB in file size. I'm not sure what you mean, as scratch supports file sizes upto 70MB. Are you trying to implement savecodes or something?No, the project.json file can go up to 5 MB uncompressed and each asset has a maximum size of 10 MB.
- Nimbus-2007
-
Scratcher
19 posts
Compressing the json file size. LOTS of really long scripts.
I tried setting the variables to zero, but nothing changed in the json at all. Are you sure there isn't any kiind of scratch file compressor out there?
- PointerOS_software
-
Scratcher
35 posts
Compressing the json file size. LOTS of really long scripts.
I tried setting the variables to zero, but nothing changed in the json at all. Are you sure there isn't any kiind of scratch file compressor out there?This video might help: https://www.youtube.com/watch?v=KTs5RKuow_M
- Nimbus-2007
-
Scratcher
19 posts
Compressing the json file size. LOTS of really long scripts.
That's not the problem. I think your confusing the json file with the size of the file in total. The full file technically can be any size, as long as the json file (a smaller file within the project that contains all the scripts and code itself) is smaller than 5 MB. Attempting little tricks to make the sprites and sounds take up less space doesn't affect the json at all. Is there any way to make the file itself smaller with a compression website or a converter?
- awesome-llama
-
Scratcher
1000+ posts
Compressing the json file size. LOTS of really long scripts.
Open up the json file and figure out what is taking up space. Many times I have gone over the limit due to variables or lists containing too much data (and I didn't realise). Lists especially can be problematic as they can easily be accidentally filled with excess data. It can be worsened by the fact scratch will try to store the list data twice (one for the actual data, the other for the list monitor), although I believe turbowarp has this fixed.
Turbowarp already tries to compress the json file so if you were working in it already, you probably won't get much benefit from additional file compressors. Note that by compression I do not mean file compression like what .zip uses, this does not matter as scratch measures the uncompressed file size. I am referring to things like smaller block IDs.
Turbowarp already tries to compress the json file so if you were working in it already, you probably won't get much benefit from additional file compressors. Note that by compression I do not mean file compression like what .zip uses, this does not matter as scratch measures the uncompressed file size. I am referring to things like smaller block IDs.
Last edited by awesome-llama (Sept. 2, 2023 16:56:07)
- Nimbus-2007
-
Scratcher
19 posts
Compressing the json file size. LOTS of really long scripts.
Alright, thanks for giving me a concrete answer. It is unfortunate that I can't really upload it to scratch, but I probably can on another platform like Github. Out of curiosity, if I were to add cloud variables to my project, and then publish it on Github, would the cloud variables still work?
- awesome-llama
-
Scratcher
1000+ posts
Compressing the json file size. LOTS of really long scripts.
Out of curiosity, if I were to add cloud variables to my project, and then publish it on Github, would the cloud variables still work?No, there needs to be a host for the cloud variable data.
- Nimbus-2007
-
Scratcher
19 posts
Compressing the json file size. LOTS of really long scripts.
Alright, thanks
- medians
-
Scratcher
1000+ posts
Compressing the json file size. LOTS of really long scripts.
They mean the project.json file, not the project itself. Also, there's no project limit anymore, the size limit used to be 10MB in 1.x for the entire project, which turned into 50MB in 2.0, but that limit was removed in 3.0 and the project.json limit was added.Load your project and reset any lists or variables you can reset. It's quite common for variables / lists to contain huge amounts of unnecessary data.Well, when I checked mine, it said it was 40 MB.Umm… Scratch is based on Javascript right? My projects have exceeded 40 MB in file size. I'm not sure what you mean, as scratch supports file sizes upto 70MB. Are you trying to implement savecodes or something?No, the project.json file can go up to 5 MB uncompressed and each asset has a maximum size of 10 MB.
To view the project.json file, you can do this:
1. Convert the “.sb3” to “.zip”. To do this, rename it and replace “.sb3” with “.zip” (since Scratch 2.0 [“.sb2”] and Scratch 3.0 [“.sb3”] projects are just “.zip” files).
2. Unzip it.
There should be all of the costumes/backdrops and sounds of the project, as well as a project.json file there.
- Spentiline
-
Scratcher
100+ posts
Compressing the json file size. LOTS of really long scripts.
It's in an .sb3 file. Rename the file extension to a .zip file extension and unzip it and you'll see what I mean.Load your project and reset any lists or variables you can reset. It's quite common for variables / lists to contain huge amounts of unnecessary data.Well, when I checked mine, it said it was 40 MB.Umm… Scratch is based on Javascript right? My projects have exceeded 40 MB in file size. I'm not sure what you mean, as scratch supports file sizes upto 70MB. Are you trying to implement savecodes or something?No, the project.json file can go up to 5 MB uncompressed and each asset has a maximum size of 10 MB.
- awesome-llama
-
Scratcher
1000+ posts
Compressing the json file size. LOTS of really long scripts.
Shortcut if you have 7-Zip…




- Discussion Forums
- » Help with Scripts
-
» Compressing the json file size. LOTS of really long scripts.