FANDOM


SandCastleIcon

This page has links to outside of the Scratch website or to Wikipedia. Always remember to be safe when using the internet since we can't guarantee the safety of other sites.

JSON (JavaScript Object Notation) is a data format based on the syntax for JavaScript object literals.[1]It is used to store Scratch projects. A project in Scratch 2.0 is actually a ZIP archive of the media and a file named "project.json," which contains the scripts.

SyntaxEdit

ObjectEdit

{"key1": value1, "key2": value2, ... "keyn": "valuen"}

ListEdit

[item1, item2, ... itemn]

How to find the JSON file of a projectEdit

Simply put this in the URL bar of your browser: http://projects.scratch.mit.edu/internalapi/project/PROJECTID/get/ and replace "PROJECTID" with the id of the project to get the JSON file of.[2]

For instance, if one would want to get the JSON file of a project with the url "https://scratch.mit.edu/projects/123456789/" they would replace "PROJECTID" with "123456789" resulting in "http://projects.scratch.mit.edu/internalapi/project/123456789/get/"

Example JSON fileEdit

Here is what the JSON file of a brand new project created in the online editor looks like:

{
 "objName": "Stage",
 "sounds": [{
   "soundName": "pop",
   "soundID": 1,
   "md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav",
   "sampleCount": 258,
   "rate": 11025,
   "format": ""
  }],
 "costumes": [{
   "costumeName": "backdrop1",
   "baseLayerID": 2,
   "baseLayerMD5": "739b5e2a2435f6e1ec2993791b423146.png",
   "bitmapResolution": 1,
   "rotationCenterX": 240,
   "rotationCenterY": 180
  }],
 "currentCostumeIndex": 0,
 "penLayerMD5": "5c81a336fab8be57adc039a8a2b33ca9.png",
 "penLayerID": -1,
 "tempoBPM": 60,
 "videoAlpha": 0.5,
 "children": [{
   "objName": "Sprite1",
   "sounds": [{
     "soundName": "meow",
     "soundID": 0,
     "md5": "83c36d806dc92327b9e7049a565c6bff.wav",
     "sampleCount": 18688,
     "rate": 22050,
     "format": ""
    }],
   "costumes": [{
     "costumeName": "costume1",
     "baseLayerID": 0,
     "baseLayerMD5": "09dc888b0b7df19f70d81588ae73420e.svg",
     "bitmapResolution": 1,
     "rotationCenterX": 47,
     "rotationCenterY": 55
    },
    {
     "costumeName": "costume2",
     "baseLayerID": 1,
     "baseLayerMD5": "3696356a03a8d938318876a593572843.svg",
     "bitmapResolution": 1,
     "rotationCenterX": 47,
     "rotationCenterY": 55
    }],
   "currentCostumeIndex": 0,
   "scratchX": 0,
   "scratchY": 0,
   "scale": 1,
   "direction": 90,
   "rotationStyle": "normal",
   "isDraggable": false,
   "indexInLibrary": 1,
   "visible": true,
   "spriteInfo": {
   }
  }],
 "info": {
  "flashVersion": "LNX 20,0,0,286",
  "swfVersion": "v443",
  "spriteCount": 1,
  "hasCloudData": false,
  "userAgent": "Mozilla\/5.0 (X11; CrOS x86_64 7647.73.0) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/48.0.2564.92 Safari\/537.36",
  "scriptCount": 0,
  "videoOn": false
 }
}

ReferencesEdit

  1. https://msdn.microsoft.com/en-us/library/bb299886.aspx
  2. https://scratch.mit.edu/discuss/post/1773451/

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.