Fix json encoding and joining?

I have an issue with a project I’m working on I need to make a block that reports a list set by another block, and to do that i encode that into a json and then decode the json.. but there’s a issue
Whenever I join the block and the string it removes the first and last [ and ]


Anyone know how to fix/stop this?

I tried appending [ and ] to the end and start of the text but it doesn’t work and snap says they are different despite them being visually identical

And even stranger it appears the text isn’t even existing

Does doing this help you?

untitled script pic - 2023-10-11T154437.693

Yeah! That worked

Do you know why this happened?

The reason this was an issue is that when you join [<text>] into a block input, it interprets the input like what happens when you select a value in the item block.
untitled script pic (19)

rather than typing the value directly in the input
untitled script pic (16)

What's the real problem here?
untitled script pic (36)

You can’t have that be in an input argument for a custom block because of inputs


So maybe more generic
untitled script pic - 2023-10-11T200701.309

untitled script pic - 2023-10-11T200713.654

used this way
untitled script pic - 2023-10-11T200723.147

That works well for 1d lists but I need 2d lists as well something I’m not sure about
This was the closest I was able to get
lets chance script pic

Aha I got it


The secret was making the 2 things into a list block and then listing the list block and calling it, then joining that with columns and a report block

You don't have to use JSON, you can also try CSV.

untitled script pic (2)

untitled script pic (3)

untitled script pic (4)

untitled script pic (5)

The downside to this is that you cant make 3D lists with CSV:

untitled script pic (6)

You could make a block that gets the dimensions of all the lists in a list, turn that data into a 2D or 1D list, and do the same for the input list.

The data set can be more than numbers, the data set can have text in it and comas so csv wasn’t really an option

CSV can handle non number data, as well as commas

It doesn’t really matter anymore as I’m using the listify block

There is a version that can work with recursive lists

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.