How to use JSON in sketchware
JSON (JavaScript object notation) is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application.
Types of data 1.Maps
Maps are key:value pairs enclosed in curly brackets( { } ) and separated by commas after each key value pairs.
In Sketchware you can convert a map to JSON by the following way:
JSON:
As you can see the map first starts with the curly bracket then comes the key:value pairs
All keys are enclosed in double quotes and values are enclosed in double quotes if it is a string. And it ends with a closing curly bracket. 2.Array
In Sketchware point of view array is just a list. Arrays are enclosed in square brackets. ([ ]). Arrays can store data including string, maps or even another array. An array inside an array is called 'nested array'.
The type of array used widely for APIs is maplist. You can generate a maplist using the following blocks
JSON:
you can use this block to convert to json stringHOW TO USE NESTED JSONYou can store an array inside another array or map. Similarly you can also store a map inside another map or array. for example: