I have a 2d Array like this:
"reels": [
[
"BL",
"77",
"BL",
"1B",
"BL",
"3B",
"BL",
"1B",
"BL",
"77",
"BL",
"2B",
"BL",
"1B",
"BL",
"LG",
"BL",
"1B",
"BL",
"3B",
"BL",
"2B"
],
[
"BL",
"77",
"BL",
"1B",
"BL",
"3B",
"BL",
"1B",
"BL",
"77",
"BL",
"2B",
"BL",
"1B",
"BL",
"LG",
"BL",
"1B",
"BL",
"3B",
"BL",
"2B"
],
[
"BL",
"77",
"BL",
"1B",
"BL",
"3B",
"BL",
"1B",
"BL",
"77",
"BL",
"2B",
"BL",
"1B",
"BL",
"LG",
"BL",
"1B",
"BL",
"3B",
"BL",
"2B"
]
]
I converted it into JSON string using:
gson.toJson(reels).toString();
The output now is:
[["BL","77","BL","1B","BL","3B","BL","1B","BL","77","BL","2B","BL","1B","BL","LG","BL","1B","BL","3B","BL","2B"],["BL","77","BL","1B","BL","3B","BL","1B","BL","77","BL","2B","BL","1B","BL","LG","BL","1B","BL","3B","BL","2B"],["BL","77","BL","1B","BL","3B","BL","1B","BL","77","BL","2B","BL","1B","BL","LG","BL","1B","BL","3B","BL","2B"]]
Now i want this String back to a multi dimensional array using JAVA only as it was in the first place. What can i do?
toJson()so why don't you look for the opposite operation and maybe some documentation on how to pass the correct type definition?Gson.fromJson()for a start...Gson.fromJson(yourJsonString, String[][].class)should work.