Only add type information when deserializing

I'm currently producing JSON to a JMS queue. I'd like to add some type info when serializing the object, which I did with the following annotations: @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "_type") @J...
more »

2017-11-23 13:11 (0) Answers

Zdef added to attribute name

Trying to serialise some fields in a POJO to XML using Jackson XMLMapper but facing some issues. The generated XML is how it should be, but XMLMapper adds some prefix to the attribute names. For example <Tax zdef-1597440208:currency="GBP">432...
more »

2017-11-06 15:11 (0) Answers

Create Xml in java fasterxml

I am using fasterxml.jackson to create xml using POJO. I am expecting output as below: <Customer xmlns=""> <firstname>FirstNameA</firstname> <middlename>LastNameA</middlename> </Customer> But getting out...
more »

2017-10-12 14:10 (1) Answers

Spring Expression Language + fasterxml

Problem is: Given a spring application with spring security and fasterxml, i need to return from a restcontroller a Role-Based filtered Json . given a bean like this public class Foo { private String name; private String url; public ...
more »

2017-10-04 18:10 (0) Answers

Redisson and Json for objects

I currently trying out Redisson as a Redis client and so far I've been able to replace a good chunk of code with no issues. The only problem I'm having now is trying to use the distributed collections, such as Queue or List. List<MyEntry> entr...
more »

2017-08-28 22:08 (0) Answers

How to rename JSON properties on child class

Here an easy example: Suppose I have two classes, MyEntity and Person: public class MyEntity { long id; String name; } public class Person extends MyEntity { String lastName; int age; // other fields } So far no problem. Now I want them...
more »

2017-06-29 14:06 (1) Answers

XMLMapper changes timezone while serialie object

I am using Jackson XMLMapper and try to serialize an object that contain XMLGaregorianCalendar. unfortunately XMLmapper change the time zone of the Calendar automatically. how can i prevent changing of time zone? this is my method to do serializatio...
more »

2017-05-21 13:05 (0) Answers

Limit write size of String with jackson

I have a list of objects with a field "description". This field can be huge (+3000 char) but I use it in the preview (I display only the 100 firsts char). Is there a way in jackson to limit the size of a String on write ? I only want jackson to crop...
more »

2017-05-17 09:05 (1) Answers

Show @JsonTypeInfo in Swagger example

We have defined a @JsonTypeInfo in a superclass, leading to @type attributes in the JSON data. The annotation is defined as follows: JsonTypeInfo( use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, include = As.PROPERTY, visible = true ) ...
more »

2017-05-02 12:05 (0) Answers

Jackson JsonMappingException: Invalid type id

I've a model with field annotated as a: @JsonTypeInfo(use = CLASS) private Object dudClass; The main problem is when I try to deserialize this object and I don't have this dudClass instance on classpath I will receive an exception: Caused by: com...
more »

2017-02-21 17:02 (1) Answers

Strange JSON serialization with FasterXML Jackson

I don't understand why I get the serialized JSON for the given Class as shown below. This is a generated class from WSDL, so I cannot change it: @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Lawyer") public class Lawyer extends Person { ...
more »

2017-02-15 15:02 (1) Answers

Jackson serialize exclude object from list

Following JSON have some parent and child relationship (sample data) "id": 1050 is child because it has "parentId": 1051 "id": 1051 is parent because it has "parentId": null Like this i have huge data { "statusCode": 200, "...
more »

2017-02-07 14:02 (1) Answers