1

I want to put a quote "" in the following json from RESTEasy (with Jackson).

{
    "isReachable": false,
    "timestamp": 1353449973347
}

{
    "isReachable": "false",
    "timestamp": "1353449973347"
}

The reason why I do that is because I am using GWT, and gwt cannot convert timestamp into long datatype. Do you know how to RESTEasy to output value as string?

Thanks

zb'
  • 8,071
  • 4
  • 41
  • 68
janetsmith
  • 8,562
  • 11
  • 58
  • 76

1 Answers1

1

You can annotate the timestamp property in your pojo that you are serializing with the @JsonSerialize annotation and instruct Jackson to use a string serializer.

public class YourPojo
{
     private boolean isReachable = false;

     @JsonSerialize(using = ToStringSerializer.class)
     private Long timestamp;

     //Getters and Setters omitted for brevity
}
gregwhitaker
  • 13,124
  • 7
  • 69
  • 78