无法在Dropwizard中正确解析jSON

时间:2016-11-16 15:12:35

标签: null jackson dropwizard

您好我有以下json,我正在尝试解析

{  
   "property1":[  
      {  
         "key1":"value1",
         "key2":"value2",
         "key3":"value3"
      }
   ],
   "property2":{  
      "key4":"value5"
   }
}

这是JSON应该序列化为

的Java对象
@Entity
@Table(name = "JavaObject")


@JsonIgnoreProperties(ignoreUnknown = true)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)

public class UserRequest implements Comparable<UserRequest>, Serializable {


    private static final long serialVersionUID = 1L;
    public static final String SIMPLE_DATE_FORMAT ="dd-M-yyyy hh:mm:ss";


    @Id
    @JsonProperty
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    long id;

    @JsonProperty
    @OneToMany(mappedBy="userRequest",fetch = FetchType.EAGER,cascade = CascadeType.ALL)
    @SortNatural
    SortedSet<Property1> property1;

    public SortedSet<Property1> getProperty1() {
        return new ConcurrentSkipListSet(this.property1);

    }

    public void setProperty1(SortedSet<Property1> property1) {
        this.Property1 = new ConcurrentSkipListSet(property1);
    }




}

当我发送请求时,它获取property1的空值。我错过了什么?

正确解析除property1以外的其他值

0 个答案:

没有答案
相关问题