How to create a JSON Toolbox with double nested Blocks?

36 views
Skip to first unread message

Felix Erdmann

unread,
Nov 28, 2024, 5:28:42 AM11/28/24
to Blockly
We are in the process of migrating our XML based Toolbox to JSON. We have one and also two level nested blocks. While there haven't been issues with the XML approach, we don't know how to implement it in JSON.

While one level nested Blocks are working without any problems in JSON, double nested Blocks are not working ("missing connection")

Expected Result (works in XML)
Screenshot 2024-11-28 at 10.15.53.png

XML
<Block type="sensebox_sd_open_file">
<Value name="SD">
<Block type="sensebox_sd_osem">
<Value name="DO">
<Block type="sensebox_sd_save_for_osem"></Block>
</Value>
</Block>
</Value>
</Block>
JSON
export const sdOpenFileSave = {
kind: "block",
type: "sensebox_sd_open_file",
inputs: {
SD: {
block: {
kind: "block",
type: "sensebox_sd_write_file",
inputs: {
DO: {
block: {
kind: "block",
type: "sensebox_sd_save_for_osem",
},
},
},
},
},
},
};

Error when using JSON
Error: The block "sensebox_sd_write_file" block (id="ypbPPuYC~Jc!%avfy@Zd") is missing a(n) DO
connection
    at loadInputBlocks$$module$build$src$core$serialization$blocks (https://studious-space-spork-g44jpg4p96v39x6-3000.app.github.dev/static/js/bundle.js:183256:40)
    at appendPrivate$$module$build$src$core$serialization$blocks (https://studious-space-spork-g44jpg4p96v39x6-3000.app.github.dev/static/js/bundle.js:183165:5)
    at loadConnection$$module$build$src$core$serialization$blocks (https://studious-space-spork-g44jpg4p96v39x6-3000.app.github.dev/static/js/bundle.js:183269:16)
    at loadInputBlocks$$module$build$src$core$serialization$blocks (https://studious-space-spork-g44jpg4p96v39x6-3000.app.github.dev/static/js/bundle.js:183257:9)
    at appendPrivate$$module$build$src$core$serialization$blocks (https://studious-space-spork-g44jpg4p96v39x6-3000.app.github.dev/static/js/bundle.js:183165:5)
    at appendInternal$$module$build$src$core$serialization$blocks (https://studious-space-spork-g44jpg4p96v39x6-3000.app.github.dev/static/js/bundle.js:183132:11)
    at VerticalFlyout$$module$build$src$core$flyout_vertical.createFlyoutBlock (https://studious-space-spork-g44jpg4p96v39x6-3000.app.github.dev/static/js/bundle.js:205158:519)
    at VerticalFlyout$$module$build$src$core$flyout_vertical.createFlyoutInfo (https://studious-space-spork-g44jpg4p96v39x6-3000.app.github.dev/static/js/bundle.js:205107:34)
    at VerticalFlyout$$module$build$src$core$flyout_vertical.show (https://studious-space-spork-g44jpg4p96v39x6-3000.app.github.dev/static/js/bundle.js:205070:20)
    at Toolbox$$module$build$src$core$toolbox$toolbox.updateFlyout_ (https://studious-space-spork-g44jpg4p96v39x6-3000.app.github.dev/static/js/bundle.js:208822:87)
 

Christopher Allen

unread,
Nov 28, 2024, 6:19:51 AM11/28/24
to blo...@googlegroups.com
Hi Felix,

We are in the process of migrating our XML based Toolbox to JSON. We have one and also two level nested blocks. While there haven't been issues with the XML approach, we don't know how to implement it in JSON.

While one level nested Blocks are working without any problems in JSON, double nested Blocks are not working ("missing connection")

That is surprising: the JSON serializer should be able to handle the same configurations of blocks that the XML serializer can—and in particular doubly-nested blocks in the toolbox should be fine.

Is it possible it's just that you've specified the wrong block type in the JSON example?:
If that's not it then please send along the relevant block definitions (or link to them, if they're public on GitHub) and we can take a further look.


Best wishes,

Christopher

Felix Erdmann

unread,
Nov 28, 2024, 8:46:26 AM11/28/24
to Blockly
Hi Christopher,

Thank you for your swift reply. Indeed it seems like I just didn't took a closer look at the block types. What a silly mistake :D 

Thank for your hint

Warm regards
Felix
Reply all
Reply to author
Forward
0 new messages