I am new about JSON. I got the following json file from the server:
[{"status":0,"hq":[["2018-04-20","11.51","11.35","-0.12","-1.05%","11.20","11.58","958691","109080.12","0.57%"],["2018-04-19","11.52","11.47","-0.03","-0.26%","11.42","11.69","849132","97959.35","0.50%"]],"code":"cn_000001","stat":["累计:","2018-04-19至2018-04-20","-0.15","-1.30%",11.2,11.69,1807823,207039.47,"1.07%"]}]
I need to get two records:
1."2018-04-20","11.51","11.35","-0.12","-1.05%","11.20","11.58","958691","109080.12","0.57%"
2."2018-04-19","11.52","11.47","-0.03","-0.26%","11.42","11.69","849132","97959.35","0.50%"
How can I parse it and with what java lib? Thanks for help!
ps. I have tried GSON, try to parse the JSON to map,
Map<String, Object> map = new Gson().fromJson(result, new TypeToken<Map<String, Object>>(){}.getType());
map.forEach((x,y)-> System.out.println("key : " + x + " , value : " + y));
And got the following exception:
Exception in thread "AWT-EventQueue-0" com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
So now I don't know how to do it. Please help. Thank you.