Discuss Scratch
- jmdzti_0-0
-
Scratcher
1000+ posts
JSON handling blocks
HUMONGOUS POST AHEAD, DO NOT QUOTE DIRECTLY.
THIS DOES NOT FALL UNDER THE CATEGORY OF
2.2 Text-based syntax in Scratch(Could’t find a dupe, please link it if there is one) It would be nice to have some advances JSON object blocks, kind of like lists and variables, but differently. This would be useful to treat lists as text, suffle lists… Here you can see some blocks that would be included. Note: The square block shape is just for clarity. They would still fit inside normal string inputs. Same with JSON object, but since i couldn’t recreate it, i just left it as a reporter. They would ideally look like curly brackets.Some users wish to code Scratch not with the blocks, but with typing code instead (similar to how more advanced programming languages work). Others are interested in an option to view, convert, or download Scratch code to other programming languages. However, the Scratch Team has discussed this possibility multiple times and has decided every time that it would not be beneficial for beginners or teachers.
This suggestion extends to coding, viewing, converting, or downloading Scratch in any text-based language, including BBCode, Javascript, some form of pseudocode, or some other programming language. If you wish to code using another language, then you can learn it on your own, but it would have to be done outside of Scratch. For those who are interested, it may be worth checking out Tosh. It is a text-based programming language that serves as a text editor for Scratch projects. Another option is MakeCode Arcade, a programming language that can convert between block-based and text-based programming within the editor.
View source
General
is [\{"apples":0\}] a [JSON object v]::#2b39b1 boolean
[\[1, 2, 3\]] = [\[3, 1, 2\]]::#2b39b1 boolean//works both for JSON objects and arrays. Order of items in arrays do not matter on this blockLists
add list named [my list] to array [\["apple","banana","orange","strawberry"\]]::list
set list [my list v] to array [\["apple","banana","orange","strawberry"\]]::list
(::ring)list [my list v] as array(::ring)::#2b39b1 ring
JSON objects
set JSON object [key] to [value] in ()::#2b39b1 reporter//creates a new JSON object if the third parameter is empty
(::ring)get all [keys v] from JSON object [] (::ring)::ring #2b39b1//options are «key» and «value»
get key () from JSON object []::#2b39b1 reporter
key #(1) of []::#2b39b1 reporter
combine JSON object [] []::#2b39b1 reporter
JSON object [] contains [key v] []?::#2b39b1 boolean
Arrays
array [] contains []?::#2b39b1 boolean
(::ring)array from text [A, B, C] with delimiter [,](::ring)::#2b39b1 ring
text from array [\["A", "B", "C"\]] with delimiter [,]::#2b39b1 reporter
(::ring)array concat [\["A", "B", "C"\]] [\["D", "E", "F"\]](::ring)::ring #2b39b1
(::ring)shuffle array [\[1, 3, 5, 2, 4\]](::ring)::#2b39b1 ring
(::ring)sort array [\[1, 3, 5, 2, 4\]](::ring)::#2b39b1 ring//works with both numbers and text (alphabetical order)
(::ring)reverse array [\["apple", "banana", "orange"\]](::ring)::#2b39b1 ring
(::ring)get array from characters [abcdefg](::ring)::#2b39b1 ring
(::ring)items [1] to [2] of array [\["apple", "banana", "orange"\]](::ring)::#2b39b1 ring
item #(1) of array [\["apple", "banana", "orange"\]]::#2b39b1 reporter
item # of [apple] of array [\["apple", "banana"\]]::#2b39b1 reporter
(::ring)insert [kiwi] at #(3) of array [\["apple", "banana", "orange"\]](::ring)::#2b39b1 ring
(::ring)flat array [\["apple", \["banana", "orange"\]\]] depth (1)(::ring)::#2b39b1 ring
(::ring)flat array [\[\["apple", \["banana", \["orange"\]\]\]\]](::ring)::#2b39b1 ring//same as above but with a depth level of infinity
(::ring)add [] to array [](::ring)::ring #2b39b1
length of array []::#2b39b1 reporter
(::ring)delete item #(1) of [\["ice cream", "apple", "banana"\]](::ring)::#2b39b1 ring
Last edited by jmdzti_0-0 (July 20, 2025 18:21:54)
- GoPackGo1919
-
Scratcher
82 posts
JSON handling blocks
- AvidOsirianGuy
-
Scratcher
100+ posts
JSON handling blocks
- jmdzti_0-0
-
Scratcher
1000+ posts
JSON handling blocks
i think that would be too complicated for a lot of scratchers, especially new ones (and me lol)
This probably would be too complex to understand at first.you’re not entitled to use those blocks. plus, i think it would be a good opportunity to learn.
Last edited by jmdzti_0-0 (July 8, 2025 19:23:48)
- AvidOsirianGuy
-
Scratcher
100+ posts
JSON handling blocks
(#4)I know, but some Scratchers may find them too complex.i think that would be too complicated for a lot of scratchers, especially new ones (and me lol)This probably would be too complex to understand at first.you’re not entitled to use those blocks.
- jmdzti_0-0
-
Scratcher
1000+ posts
JSON handling blocks
They would be in a separate extension, most people wouldn’t even notice it.(#4)I know, but some Scratchers may find them too complex.i think that would be too complicated for a lot of scratchers, especially new ones (and me lol)This probably would be too complex to understand at first.you’re not entitled to use those blocks.
Last edited by jmdzti_0-0 (March 2, 2025 15:15:31)
- michaeljackson1365
-
Scratcher
1000+ posts
JSON handling blocks
- BigNate469
-
Scratcher
1000+ posts
JSON handling blocks
- Bo_Tie
-
Scratcher
87 posts
JSON handling blocks
- BoogsX15
-
Scratcher
1000+ posts
JSON handling blocks
too complicated scratch is for kids! kids probably wont know how to handle json at first glance
- jmdzti_0-0
-
Scratcher
1000+ posts
JSON handling blocks
Last edited by jmdzti_0-0 (July 7, 2025 07:41:06)
- jmdzti_0-0
-
Scratcher
1000+ posts
JSON handling blocks
How would it deal with objects? Scratch has no built-in way of handling random objects.javascript does
+ random bump i guess
- jmdzti_0-0
-
Scratcher
1000+ posts
JSON handling blocks
- jmdzti_0-0
-
Scratcher
1000+ posts
JSON handling blocks
Sorry, you have to wait 60 seconds between posts.
Last edited by jmdzti_0-0 (July 19, 2025 12:13:02)
- abrakaidabra
-
Scratcher
500+ posts
JSON handling blocks
Oh btw this is my 500th post!

Last edited by abrakaidabra (July 8, 2025 19:18:25)
- Scratch_Cat_Coder8
-
Scratcher
1000+ posts
JSON handling blocks
Last edited by Scratch_Cat_Coder8 (July 8, 2025 20:30:05)