Parsing a 2-dimensional JSON array
in
Programming Questions
•
5 months ago
I'm trying to parse a JSON array like the one in the following string:
- {"type":"grid","grid":"[[0,0,0,0,0],[0,0,0,{\"x\":1,\"y\":3},0],[0,0,{\"x\":2,\"y\":2},0,0],[{\"x\":3,\"y\":0},{\"x\":3,\"y\":1},0,0,0],[{\"x\":4,\"y\":0},0,0,0,0]]"}
I can use JSONObject to parse the string information like so,
- JSONObject test = JSONObject.parse(msg);
- String type = test.getString("type");
But, for the life of me, I cannot figure out how to get the array into a processing data structure. Please help?
1