A simple scratch extension that allow access to values of JSON objects online.
This simple JavaScript extension allows you to access the attributes of JSON objects online from Scratch, from their URL and simple representation of their properties. It adds blocks for declaring objects and properties, and access their values that can be assigned to variables or used directly in expressions to change, for example, the size, direction, position of srpites.
Because this is not an official extension, you can need to take some steps to use it:
- Create or open a projet on scratch.mit.edu
- Open the JavaScript console in you browser
- Copy-paste the JavaScript code in the extension
Once you have done that, new blocks should appear in the "More blocks" section of scratch. If you have opened a project that already uses this extension, but it is not loaded, the corresponding block will show "undefined". Reproducing the steps above should fix that.
Once you have installed it, the use is relativly simple. You can define an object using its URL, asusming that this URL would respond with JSON code if called. You can define a property using the JSONPath to access the value your are looking in the corresponding object. For example, to get the value of the first item in the list of search results might look something like "results[0].value"
... will come soon.