can somebody show code which deserialize json to TreeMap? Some simple example which includes example of json I'll show what I've tried First of all I am newbie so forgive me That's my json(probably i have mistakes even here):
{"Car":[{"mark":"AUDI_A3", "colour": "black"},
{"mark":"BMW_m3", "colour": "white"}]}
There is my code which does not work
public static void main(String[] args) {
open();
}
private static void open(){
try {
BufferedReader buff = new BufferedReader(new FileReader("C:\Users\\t1.json"));
String bf=null;
String json= null;
while((bf=buff.readLine())!=null){
json+=bf;
}
Gson gson = new Gson();
Type type = new TypeToken<TreeMap<String, SmallGuys>>(){}.getType();
TreeMap<String, SmallGuys> Platoon = gson.fromJson(json, type);
System.out.print(Platoon.keySet());
}
catch (Exception e){
System.out.println("There is a mistake");
}
}