I wish to use GSON to parse the following json:
[
[
\"hello\",
1,
[2]
],
[
\"world\",
3,
[2]
First, I think you may be mistaken in your example above. An Array consisting of three different is a very unusual approach, to say the least. Probably your json structure is an array, containing tuples. These tuples then include an array.
Like:
[
{
"hello",
1,
[2]
},
{
"world",
3,
[2]
}
]
XXX should be an object containing:
A String
An int (or Integer)
An Array of (I guess) ints.
Then you make an array of these objects and parse the json into it.
However, your json seems really badly formed, since all members should be named, like
[
{
"str":"hello",
"intVal":1,
"intArr":[2]
},
{
"str":"world",
"intVal":3,
"intArr":[2]
}
]
If, on the other hand, the JSON really looks the way you describe it, you would have to make arrays of Object, plain and simple, and then cast them when you read them from your data structure.