How to deserialize a list to a map using fastmap

112 views Asked by At

I have a JSON that has a list of objects inside another object, something like:

{
   "name":"name",
   "processes":[
      {
         "id":123,
         "desc":"main"
      },
      {
         "id":456,
         "desc":"secondary"
      }
   ]
}

I want to parse fastjson to something like:

public class Idea {

    private String name;
    private Map<String, List<Process>> processes;
    
    //Getters and setters
}

and

public class Process {

    private String id;
    private String desc;
    
    //Getters and setters
}

Basically, the idea is to map that list from the JSON to a map where the key is something like Processes and the values are the list got from the JSON.

Any idea on how I could do it?

0

There are 0 answers