简体   繁体   中英

convert JSON to Object by Jackson

I have specific JSON. for example:

legs":{
    "dir0":{},
    "dir1":{}
}

Parent class:

public class Record{
    @JsonProperty("legs")
    private Leg legs;
    //getter setter
}

How I can define my class Leg to get List<Dir> or Map<String,Dir> ? where Dir contains properties of dir0, dir1...

I understand my trouble. I have exess class Leg . I need to do like this:

public class Record{
           @JsonProperty("legs")
           private Map<String,Dir> dirs;
           //getter setter
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM