JSON and Arrays

The JSON (JavaScript Object Notation) and Arrays libraries allow you to create JavaScript Objects and Arrays in Scratch. Although you will not be able to see the data directly as with Scratch variables, these structures can be far more complex and useful.

All data created with this library is not persistent; all objects will be deleted entirely once the user leaves the page. Consider using the Save library in conjunction with this library to save data to the user's computer.

Dot Notation
Dot notation is a way to represent objects. Since objects can act as containers for other objects, the only way to refer to a specify object is by specifying each name that is the parent of an object, separated with the dot '.' character. For example the following notation: box.folder.content refers to the "content" property of the object called "folder" that is within the object called "box"

To conform with the other naming conventions, it is recommended to only use alphanumeric characters and the underscore '_' character to name variables. It is also recommended to start the names of variables with a lowercase letter. For example, the name "Xvalue" and "x value" are unacceptable names, although "xValue" and "x_value" are ok.

Objects
Objects are collections of name-value pairs (also know as key-value pairs). Just like variables, name-value pairs are a way of storing data. The added advantage is the ability to store objects within other objects and create complex tree structures.

As an arbitrarily ordered collection, the order of name-value pairs in an object can change when they are added are or removed. For this reason, it should be assumed the order of name-value pairs is random.

With Javascript, the language that ScratchExt is written in, all variables can be interpreted as objects. This includes integers, strings, and arrays. Thus, some object related blocks, such as the delete block, can be use with arrays.

Example
TO-DO

Arrays
Arrays work just like Scratch lists, but can be used to work with JSON objects. Other functions such as sorting may be added in the future update.

Example
TO-DO

Blocks: Objects
† The order of properties may not be maintained and should be assumed to be random.

Blocks: Arrays
TO-DO