I have a String that is formatted like a 2D array like this:
"[[1, 0, 0, 0], [1, 0, 0, 0], [1, 0, 0, 0], [1, 0, 0, 0]]"
How can I get the program to read the string as an actual 2D array like this
[[1, 0, 0, 0], [1, 0, 0, 0], [1, 0, 0, 0], [1, 0, 0, 0]]
so that I can perform matrix calculations?
I've tried removing the commas and brackets and then converting the string numbers to integer numbers but that does not work because I need to keep the shape of the 2D array. In this example, I would need the final 2D array to be size [4][4].