From Test-Scratch-Wiki
![]() |
This page has links to outside of the Scratch website or Wikipedia. Remember to stay safe when using the internet as we can't guarantee the safety of other sites. |
This is a tutorial for modifying the Scratch JSON code.
Warning: Only change code if you consider yourself advanced with computers. Your project may break forever if you modify it incorrectly and do not know how to revert your code. A backup is recommended!
Projects made in Scratch 2.0 are stored in something called the JavaScript Object Notation (JSON).
You can modify this if needed.
In this tutorial Windows 7 will be used.
This is a tutorial for modifying the Scratch JSON code on Windows32.
Requirements
You will need:
- The Scratch 2.0 Offline Editor
- A working knowledge of JSON
- A ZIP extractor and text editor (You probably have Microsoft Notepad)
Your computer will also need to show file extensions for every file (you can do that here).
Tutorial
Create the project you want to modify in the Offline Editor.
Save it to your Desktop.
Now, make sure that you can see the file extension.
You will need to rename the extension.
If your project is named "MyProject.sb2", rename this to "MyProject.zip"
On Windows, you may get a warning that the program may no longer work properly if the extension is renamed. Accept this warning as we will rename the file back to .sb2 later.
Open the zip file.
You will see svg, png, and wav files with numbers. Those are the costumes and sounds for the project.
Open project.json with Notepad.
In this tutorial, we'll be changing the boolean to a string.
Search for your custom block. In this tutorial, the block is called "The Scratch Wiki".
Change the part that says:
"The Scratch Wiki %b"
to say:
"The Scratch Wiki %s"
Now save project.json, rename MyProject.zip to MyProject.sb2, and open it up with the offline editor.
Here is the finished result:
JSON Tutorial - Creating Custom Block drop-downs
Create a project with two Custom Blocks placed down in the Scratch Editor.
define List Dropdown (list) List Dropdown [text...] define Variable Dropdown (var) Variable Dropdown [text...]
Download the project as Project.zip
open the ZIP file you just saved and open the File named Project.JSON
, open this file in your built in text editor. In the file find the word 'Dropdown'. After the search you should find something that says:
"scripts": [[37.05,
Were it says
62.7,
[["procDef", "List Dropdown %s", ["list"], [""], false],
["call", "List Dropdown %s", ""]]],
[37.8,
163.1,
[["procDef", "Variable Dropdown %s", ["var"], [""], false],
["call", "Variable Dropdown %s", ""]]]],
%s
in the "List Dropdown..." line replace that with %m.list
. This tells you that it will be a list dropdown menu. Were it says %s
in the "Var Dropdown..." line replace that with %m.var
. This simply means that it is a variable dropdown menu.
Next, Save the Project.JSON
file back into the .ZIP file. Open the Editor and click File » Upload From Your Computer
and choose the .ZIP file. If a warning pops up click 'Yes'. Viola, here is the outcome:
define List Dropdown (list) List Dropdown [ v] define Variable Dropdown (var) Variable Dropdown [ v]