a extension i created yesterday
purpose: bringing json to snap and adding more than the [scratchblocks] ( [json v] of list :: list ) [/scratchblocks]
a extension i created yesterday
purpose: bringing json to snap and adding more than the [scratchblocks] ( [json v] of list :: list ) [/scratchblocks]
This extension is very helpful!
The Snap! SPLIT BY JSON primitive doesn't distinguish JSON arrays from JSON objects with {name: value} pairs:
You do have a block that (like the SPLIT primitive) creates a length-2 list, but you don't index JSON strings by attribute name. That is, in addition to your
block, you should also have
Note that it's an error to index an object by item position:
Similarly, things like REPLACE should be able to replace the value associated with a given name in the JSON string.
JavaScript, where JSON came from, has a primitive Object data type with key-value pairs. Snap! doesn't, instead using 2D arrays for that purpose. Thus, our ITEM block allows keyword indexing:
How do I easily type text in a number input without having to use the join block or editing stuff or whatever?
The ITEM block just lets you do that. There's no nice way to do it on other blocks.
I know, but the only non-numeric characters I can write are "e" and "-".
"e" is for scientific notation (like 1e10 for 1010) and "-" is for negatives.
Yes, but I still want to write text into number inputs.
You'll be forced to use JOIN or a similar block then.
forgot to close your <sup>
. :-)
For some reason i put </small>
instead of </sup>
.
Ah. Makes sense.
sup small sub
i forgor about adding that
btw i didnt know about that, i tried making it similar to lists so when people know how lists work, they can easily use it
UPDATE:
added 'is json valid' block
changed the 'is json empty' block