I'm calling a RESTful api which gives me the following response:
{
"asks": [
[
"219.82",
"2.19"
],
[
"219.83",
"6.05"
]
],
"bids": [
[
"219.40",
"17.46"
],
[
"219.13",
"53.93"
]
]
}
My data object implementation looks now like this:
public class OrderBook implements Serializable {
/**
* list containing the price and amount of all bid orders
*/
private String[][] bids;
/**
* list containing the price and amount
* of all ask orders
*/
private String[][] asks;
}
How can I replace this String[][] with a data object and ensure that GSON can still parse it?
The api is external and I cant there change anything. The result is an array of an array with two properties. Instead of parsing this in java with GSON in a String[][], I'd like to have a Asks and Bids class. The Asks class should contain an array of the object Ask and the object Ask should have two variables: which are value and amount as String. This is what I'd like to have in my java code.