Converts Scratch 2 to Scratch 3 JSON representations.
Converts Scratch 2 to Scratch 3 JSON representations using LLK/scratch-vm.
Usage: node convert.js [options]
Note that you’ll always see a lot of errors as a result of running the headless Scratch VM with minimal features enabled (no audio renderer, etc.).
Convert all projects in directory SRC, saving new ones to root directory DEST, preserving directory structures recursively:
node convert.js -d DEST SRC
Convert projects A, B, C, and those in the directory SRC, to root directory DEST, without preserving directory structures:
node convert.js -ud DEST A B C SRC
To use this code as a server to convert one project at a time, run node app.js
.
Then you can POST to /convert
with your Scratch 2 project JSON as the only data, with header application/json
.
You’ll receive the Scratch 3 JSON in return.
As a Python example:
import json
import requests
with open("test.json") as f:
sb2 = json.load(f)
r = requests.post("http://localhost:3000/convert", json=sb2)
print(r.text)