I have a string in Java like this:
String s = "{{\"2D\", \"array\"}, {\"represented\", \"in a string\"}}"
How can I convert it into an actual array? Like so:
String[][] a = {{"2D", "array"}, {"represented", "in a string"}}
(What I'm looking for is a solution a bit like python's eval())
[...], not{...}. If it's really as simple as shown, of course the OP could do areplaceAllfirst to change those over, but it's probably not actually as simple as shown.String[]and initialize it withString[][]. If you don't know in advance the dimensionality of your array, this is not a simple problem at all.