AnsweredAssumed Answered

Jackson Annotations not working

Question asked by mangar on Mar 28, 2014
Latest reply on Mar 29, 2014 by mangar
I have an object that I am trying to serialize in a webscript.  I have bee doing this forever now:

            res.addHeader("Accept", "application/json");
            res.addHeader("Content-type", "application/json; charset=UTF-8");

and everything is fine.

I have now added annotations to my beans. I have an abstract superclass that I use @JsonTypeInfo, and a @JsonIgnore for some field.
However, I do NOT see the @class property that should have been added, and the field marked ignore is showing up.

I then added this as a test.

@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class")
public abstract class A {


public class B extends A {
   private String x;

   public String getX() {
      return x;

   public void setX(String x) {
      this.x = x;

and in a webscript I do this:

      B b = new B();
      mapper = new ObjectMapper();

and my output is:


when I run it in a static main() I get the correct output:


Is there some special thing I need to do to turn on annotaions for Alfresco webscripts?