Something like this is valid JSON and works, but you need to decide on the structure yourself:
Hope that helps. Good luck!
This answered two of my posts which led to other post with also solved answer
For anyone who came here in future:
Here is what I did. I was using array in this post because dict didn’t work another day (in that same link) so I tested array and it results the same thing as dict. I made a mistake by using parse on array when it should be dict. I did not realize my dict output is not json configured properly. Here is the tool that helps you to confirm if it’s parsable or not. So I reverted my code back to other post to solve this issue.
If you are here for array only, here is what I did with an array only then I went back to dict after this post answered:
here is what I did to turn the output into 1D.
if stored_value != "":
var array_test = stored_value.replace("[", "")
array_test = array_test.replace("]", "")
test=array_test.split(",", true, '0')
Basically, stored_value gets output like this:
[[5, 6, 1], [8, 3, 7], [4, 4, 3], [1, 1, 6], [9, 9, 7], [2, 9, 3], [3, 2, 7], [4, 5, 1], [9, 3, 2], [8, 5, 6], [4, 4, 5], [4, 6, 2], [2, 4, 9], [9, 2, 3], [1, 4, 4], [7, 6, 1], [1, 9, 3], [9, 7, 2], [3, 8, 6], [4, 8, 2], [7, 9, 9], [4, 6, 4], [1, 4, 6], [2, 9, 7], [3, 6, 2], [1, 9, 5], [3, 4, 4], [7, 2, 5], [8, 9, 1], [3, 8, 1], [7, 6, 5], [8, 2, 5], [8, 7, 1], [5, 5, 4], [6, 9, 8], [9, 9, 6], [6, 6, 5], [6, 3, 6], [9, 9, 8], [5, 1, 2], [7, 6, 6], [8, 8, 7], [3, 3, 9], [6, 1, 8], [4, 5, 2], [6, 9, 3], [1, 5, 7], [9, 3, 6], [1, 7, 4], [5, 5, 8], [3, 7, 6], [2, 4, 1], [8, 2, 2], [5, 7, 8], [9, 7, 3], [1, 9, 4], [8, 6, 2], [5, 4, 3], [2, 1, 7], [2, 2, 6], [4, 1, 9], [2, 6, 6], [5, 8, 5], [4, 4, 4], [9, 5, 1], [6, 7, 3], [5, 5, 5], [9, 3, 3], [4, 2, 3], [4, 6, 3], [7, 2, 2], [1, 1, 9], [9, 5, 3], [8, 9, 7], [1, 8, 5], [6, 9, 2], [7, 4, 2], [5, 4, 9], [7, 2, 4], [1, 4, 7], [2, 8, 9], [8, 9, 9], [2, 3, 7], [8, 7, 9], [6, 3, 3], [3, 1, 6], [3, 3, 3], [9, 5, 7], [6, 1, 5], [3, 8, 2], [1, 8, 9], [9, 6, 8]]
to this processed output:
[5, 6, 1, 8, 3, 7, 4, 4, 3, 1, 1, 6, 9, 9, 7, 2, 9, 3, 3, 2, 7, 4, 5, 1, 9, 3, 2, 8, 5, 6, 4, 4, 5, 4, 6, 2, 2, 4, 9, 9, 2, 3, 1, 4, 4, 7, 6, 1, 1, 9, 3, 9, 7, 2, 3, 8, 6, 4, 8, 2, 7, 9, 9, 4, 6, 4, 1, 4, 6, 2, 9, 7, 3, 6, 2, 1, 9, 5, 3, 4, 4, 7, 2, 5, 8, 9, 1, 3, 8, 1, 7, 6, 5, 8, 2, 5, 8, 7, 1, 5, 5, 4, 6, 9, 8, 9, 9, 6, 6, 6, 5, 6, 3, 6, 9, 9, 8, 5, 1, 2, 7, 6, 6, 8, 8, 7, 3, 3, 9, 6, 1, 8, 4, 5, 2, 6, 9, 3, 1, 5, 7, 9, 3, 6, 1, 7, 4, 5, 5, 8, 3, 7, 6, 2, 4, 1, 8, 2, 2, 5, 7, 8, 9, 7, 3, 1, 9, 4, 8, 6, 2, 5, 4, 3, 2, 1, 7, 2, 2, 6, 4, 1, 9, 2, 6, 6, 5, 8, 5, 4, 4, 4, 9, 5, 1, 6, 7, 3, 5, 5, 5, 9, 3, 3, 4, 2, 3, 4, 6, 3, 7, 2, 2, 1, 1, 9, 9, 5, 3, 8, 9, 7, 1, 8, 5, 6, 9, 2, 7, 4, 2, 5, 4, 9, 7, 2, 4, 1, 4, 7, 2, 8, 9, 8, 9, 9, 2, 3, 7, 8, 7, 9, 6, 3, 3, 3, 1, 6, 3, 3, 3, 9, 5, 7, 6, 1, 5, 3, 8, 2, 1, 8, 9, 9, 6, 8]
So, I did something like this to generate x,y,z:
while key < total:
if flag == 0:
flag = flag + 1
x = int(test[key])
elif flag == 1:
flag = flag + 1
y = int(test[key])
elif flag == 2:
flag = 0
z = int(test[key])
$GridMap.set_cell_item(x,y,z, 0)
Obv, you will have your own goal. This is only example for you to get the idea. Hopefully, you have a better idea than this.
By the time you come to here, I’m probably more experience by that time (approx 3 months from now on) so feel free to ask or correct me (if you caught something off so you can educate others and me)
Spacejase, thank you for your time!!!
kakcalu13 | 2021-11-23 15:34