How to use @JsonIdentityInfo with circular references?

I am trying to use the @JsonIdentityInfo from Jackson 2 as described here. For testing purposes I created the following two classes: public class A { private B b; // constructor(s) and getter/setter omitted } public class B { private A a; // see above } Of course, the naive approach failes: @Test public void … Read more

Jackson deserialization with Kotlin default value fail

I’m using Jackson to deserialize Json responses from Retrofit. I use the Jackson Module Kotlin library for that. I have data classes with default values for some values that Java represents as primitives, so it won’t crash when accessing it without null check. This all works fine in debug mode, but when I run on … Read more

Configure Jersey/Jackson to NOT use @XmlElement field annotation for JSON field naming

I am running a Jersey REST service. The POJO’s which represent my resources are JAXB (XML) annotated simple Java classes (they are generated from a schema definition – so they have the annotations). I want Jersey/Jackson to ignore the XML-Annotations. I did this configuration in my web.xml (as mentioned here): <init-param> <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name> <param-value>true</param-value> </init-param> I … Read more

Spring Boot – Encrypt JSON data

In our application we have to encrypt/decrypt the Json property values (not the property name) for each request and response. Example, {“userName”:”encrypted value”, “email”:”encrypted value”} We use Sprint boot 1.3 and we are using @RequestBody and @ResponseBody annotations to bind the request json with the object and serialise the response object as JSON. We don’t … Read more

Jackson list deserialization. nested Lists

I’m working on creating an API that has nested lists. Jackson seems like a great tool to create objects, but I can’t quite figure out how to nest a list, and I’m wondering if its possible. My object looks like this. public class Order { public String name; public List<Item> items; } I’m hoping there … Read more

Which JAR file contains the JsonProcessingException class?

When I try to use Jackson 2.1.1 with the following jar files (in Spring 3.2.2), jackson-core-2.1.1.jar jackson-annotations-2.1.1.jar jackson-databind-2.1.1.jar I get the following exception. java.lang.ClassNotFoundException: org.codehaus.jackson.JsonProcessingException So I think, the class JsonProcessingException is contained by the jackson-core-asl-2.1.1.jar file (I’m not quite sure though) but I cannot see this file in the download. So where to get … Read more

Convert JSON many objects to single JSON using Jackson

I have JSON, with differents levels field, so I want to convert to a single JSON with fields with one level for example: { “prop1″:”value1”, “prob2″:”value2”, “prop3”: { “prop4″:”value4”, “prop5″:”value5” } … many level fields } result { “prop1″:”value1”, “prop2″:”value2”, “prop4″:”value4”, “prop5″:”value5” ……. } I’m using Jackson with annotation @JsonProperty(“field”), I haven’t problem wih fields … Read more

Exception using Jackson JSON library with camel

I am having trouble using the Jackson JSON library with camel. The exception is: FailedToCreateRouteException: Failed to create route… because of Data format ‘json-jackson’ could not be created. Ensure the data format is valid and the associated Camel component is present on the classpath Here is the beginning of classpath notice that the Jackson libs … Read more

Registering JacksonJsonProvider with ObjectMapper + JavaTimeModule to Jersey 2 Client

I’m trying to marshal response containing ISO formatted timestamp like that: { … “time” : “2014-07-02T04:00:00.000000Z” … } into ZonedDateTime field in my domain model object. Eventually it works if I use solution that is commented in following snippet.There are many similar questions on SO but I would like to get a specific answer what … Read more