无法将字符串转换为 JsonArray
如何将此字符串转换为gson。JsonArray?
String s= "[["110917 ", 3.0099999999999998, -0.72999999999999998, 2.8500000000000001, 2.96, 685.0, 38603.0], ["110917 ", 2.71, 0.20999999999999999, 2.8199999999999998, 2.8999999999999999, 2987.0, 33762.0]]";
这是我的代码:
com.google.gson.*;
public static void main(String[] args)
{
//Declared S here
System.out.println("String to Json Array Stmt");
JsonParser parser = new JsonParser();
JsonElement tradeElement = parser.parse(s.toString());
JsonArray trade = tradeElement.getAsJsonArray();
System.out.println(trade);
}
这是将此集合字符串转换为 JSonArray 的方法吗?