KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have polymorphic types and deserializing from JSON to POJO works. I followed the documentation here , in fact. When serializing POJOs into JSON I'm getting an unwanted attribute, specifically the logical type name. import static org.codehaus.jackson.annotate.JsonTypeInfo.*; @JsonTypeInfo(use=Id.NAME, include=As.PROPERTY, property="type") @JsonSubTypes({ @JsonSubTypes.Type(value=Dog.class, name="dog"), @JsonSubTypes.Type(value=Cat.class, name="cat") }) public class Animal { ... } public class Dog extends Animal { ... } public class Cat extends Animal { ... } When Jackson serializes into JSON it provides the type information which I don't want to expose. {"type":"dog", ... } {"type":"cat", ... } Can I prevent this somehow? I only want to ignore type when deserializing.
Tags (comma-separated)
Save Edits
Cancel