如何在Camel中使用Jackson' fasterxml.jackson'解析pojo到简单的String json中而没有完整的类名

时间:2018-01-04 08:09:58

标签: java json jackson apache-camel

我使用骆驼(使用杰克逊解析)&在json中解析我的pojos,但我得到输出json:

{"com.xyz.Demo":{"key1":"val1","key2":"val2","fruits":
{"@serialization":"custom","unserializable-parents":"","list":{"default":
{"size":1},"int":1,"com.xyz.demo.Fruit":{"colour":"orange","timeStamp":"2020-
01-01T02:55:45Z"}}}}}

我只想要类名,而不是完整包。 也不想要:" @ serialization":" custom"," unserializable-parents":""

各个班级:

public class Demo {
 private String key1 = null;
 private String key2 = null;
 private Fruits fruits = null;
}

public class Fruits extends ArrayList<Fruit> {
}

public class Fruit {
 private String colour = null;
 private String timeStamp = null;
}

Camel路线转换:.marshal()。json()

尝试用@JsonRootName注释模型类,没有用。

0 个答案:

没有答案