Discuss Scratch

jmdzti_0-0
Scratcher
1000+ posts

JSON handling blocks

I’m sorry to any high-contrast users
HUMONGOUS POST AHEAD, DO NOT QUOTE DIRECTLY.
THIS DOES NOT FALL UNDER THE CATEGORY OF

The Official List of Rejected Suggestions wrote:

2.2 Text-based syntax in Scratch

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
(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.

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 block

Lists
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

i think that would be too complicated for a lot of scratchers, especially new ones (and me lol)
AvidOsirianGuy
Scratcher
100+ posts

JSON handling blocks

This probably would be too complex to understand at first.
jmdzti_0-0
Scratcher
1000+ posts

JSON handling blocks

GoPackGo1919 wrote:

i think that would be too complicated for a lot of scratchers, especially new ones (and me lol)

AvidOsirianGuy wrote:

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

jmdzti_0-0 wrote:

(#4)

GoPackGo1919 wrote:

i think that would be too complicated for a lot of scratchers, especially new ones (and me lol)

AvidOsirianGuy wrote:

This probably would be too complex to understand at first.
you’re not entitled to use those blocks.
I know, but some Scratchers may find them too complex.
jmdzti_0-0
Scratcher
1000+ posts

JSON handling blocks

AvidOsirianGuy wrote:

jmdzti_0-0 wrote:

(#4)

GoPackGo1919 wrote:

i think that would be too complicated for a lot of scratchers, especially new ones (and me lol)

AvidOsirianGuy wrote:

This probably would be too complex to understand at first.
you’re not entitled to use those blocks.
I know, but some Scratchers may find them too complex.
They would be in a separate extension, most people wouldn’t even notice it.

Last edited by jmdzti_0-0 (March 2, 2025 15:15:31)

jmdzti_0-0
Scratcher
1000+ posts

JSON handling blocks

bump
jmdzti_0-0
Scratcher
1000+ posts

JSON handling blocks

bump
michaeljackson1365
Scratcher
1000+ posts

JSON handling blocks

Support, but this could be confusing and complicated, especially for New Scratchers.
BigNate469
Scratcher
1000+ posts

JSON handling blocks

How would it deal with objects? Scratch has no built-in way of handling random objects.
Bo_Tie
Scratcher
87 posts

JSON handling blocks

as much as this would massively help in making more complex projects, i don't think this is the right way to go about it. even if new scratchers don't “have to use it”, i think accessibility and understandability should be the first thing that any fully-new scratch blocks have. i think there's definitely ways to make simplified version of the json idea work (and i think i'll make a suggestion on my idea), but in the way that it is now though, no support for these json blocks
BoogsX15
Scratcher
1000+ posts

JSON handling blocks

no support

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

bump

Last edited by jmdzti_0-0 (July 7, 2025 07:41:06)

jmdzti_0-0
Scratcher
1000+ posts

JSON handling blocks

bump
jmdzti_0-0
Scratcher
1000+ posts

JSON handling blocks

BigNate469 wrote:

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

bumupu
jmdzti_0-0
Scratcher
1000+ posts

JSON handling blocks

bump again because scratch decided not to bump my topic ̇з̇
jmdzti_0-0
Scratcher
1000+ posts

JSON handling blocks

bump
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

I like the idea! This would make a lot of things easier in scratch for more advanced users. However, this would be incredibly difficult for new scratchers to wrap their heads around, so how about this be an optional extension (like pen), similar to the way they have the JSON extension in turbowarp?

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

I support! Although this would be better off as a lower section in the code list that needs to be activated by the project creator with a warning saying like “this feature is highly recommended for those who have a lot more experience with coding or are wiling to learn more, not recommend for newer users” so newer or under-experienced users don’t feel like they absolutely have to use them immediately and they aren’t entirely important for them at that stage of learning. Plus the blocks can kinda help with learning between blocks and text based code!

Last edited by Scratch_Cat_Coder8 (July 8, 2025 20:30:05)

Powered by DjangoBB