Questions tagged [jackson2]

Use this tag only for questions specifically related to version 2 of the Jackson library

Jackson version 2 is a Java serialization and deserialization API typically used for reading and writing JSON, although other data formats such as Avro, CBOR, CSV, Java Properties, Protobuf, Smile, XML, and YAML are also supported.

464 questions
1
vote
2 answers

Jackson not serializing property

I have the following two enums public enum Action { ACTION1, ACTION2, ACTION3; } public enum EntityType { ENTITYTYPE1, ENTITYTYPE2; } and the following class public class EntityIdentityDto implements MetaData { private…
Khetho Mtembo
  • 388
  • 6
  • 20
1
vote
1 answer

Should RestTemplate (w/ Jackson) Call Fail If JSON Has an Invalid Property Name

I have the following REST call with Spring's (5.0.1) RestTemplate and Jackson 2 (fasterxml) converter: final List> messageConverters = restTemplate.getMessageConverters(); MappingJackson2HttpMessageConverter converter =…
NuCradle
  • 665
  • 1
  • 9
  • 31
1
vote
0 answers

ObjectMapper with Custom class loader

We get some json string which needs to be converted into instance of a class which is part of some third party jar (which will be downloaded on the fly) which is not present in the class path. and problem here is We get below kind of Json { …
1
vote
1 answer

No serializer found for class ...(to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)

Objective: Create an API that allows me to search for data in the article journal, retrieve its data in a class Item, display it in Json format. Path: I created a project on Liferay 6.1 using the Service Builder Portlet plugin. In my service.xml…
woodson
  • 31
  • 1
  • 4
  • 8
1
vote
1 answer

Spring MVC Jackson message converter: "Conflicting setter definitions"

I have a Spring Boot application with a controller that has an endpoint that accepts an object as a parameter, like this: @RestController public class MyController { @PostMapping("/Student") public String createStudent(@RequestBody Student…
DraegerMTN
  • 1,001
  • 2
  • 12
  • 21
1
vote
2 answers

Stop Jackson reading numbers as String

Jackson reads input numbers as Strings. As an example below Student class read name 4567 as a String. ex: input { name: 4567 ... } Java class Class Student { String name; ... } Jackson is parsing the JSON text and mapping the number value to the…
era
  • 391
  • 4
  • 24
1
vote
0 answers

Facing issue with jackson date converstion

We are using spring boot for our REST application we are facing issue while using date conversion as mention below if we get a date as 2019-03-13 from payload then while converting in to date using jackson2 we get it as 2019-03-12 which is a day…
Aniket
  • 11
  • 1
1
vote
0 answers

Jackson serialization error with a crazy date

We are facing some weird behavior with date serializations with Jackson. It is happening very rarely. In one example, we send a POST request with a serialized date in format: public static String createUTCdateString() { //Time in GMT …
Orkun
  • 6,998
  • 8
  • 56
  • 103
1
vote
2 answers

Jackson registerSubtypes not working in Kotlin

I was trying to use the registerSubtypes function from Jackson following this tutorial. So I've converted this code into Kotlin like so: interface Vehicle { val name: String } class Car @JsonCreator constructor(@JsonProperty("name") override val…
Benoit TH
  • 601
  • 3
  • 12
1
vote
1 answer

How to map/group JSON properties by prefix to List of objects with Jackson?

I have JSON response: { "part1.id": "1", "part1.name": "Name1", "part2.id": "2", "part2.name": "Name2" } POJO / DTO class for 1 user: public class User { private String id; private String name; //…
Justinas Jakavonis
  • 8,220
  • 10
  • 69
  • 114
1
vote
0 answers

Exception while deserializing with @JsonRootName

Desirialization does not work when there are multiple nodes available at same level as value provided in the JsonRootName Note: Wrapper is configured with following: objectMapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); Class:…
Priti Biyani
  • 414
  • 5
  • 11
1
vote
1 answer

Jackson TreeModel vs Databinding

I am trying to think of scenario to use Jackson TreeModel and Databinding API (Object mapper). When you would chose one again the another ?
Leo Prince
  • 940
  • 2
  • 14
  • 33
1
vote
1 answer

Jackson naming convention issue in serialization with uncommon getter method name

New to java and spring boot. While trying to serialize the following class, public class ActionItems { private String APpID; public String getAPpID() { return APpID; } public void setAPpID(String aPpID) { APpID = aPpID; } // other…
NANDAKUMAR THANGAVELU
  • 611
  • 3
  • 15
  • 34
1
vote
1 answer

Jackson deserializer priority?

I have a Spring Boot app that is modeling ActityStreams objects and for the most part Jackson's Polymorphic Deserialization works well. There are 'objects' in the JSON which are references (links) and not JSON objects with type information. For…
Mike Summers
  • 2,139
  • 3
  • 27
  • 57
1
vote
1 answer

Validating (required=true) set in JsonProperty while using ObjectMapper in Jackson should throw Exception

I am trying to use Jackson library for deserialization since I have a scenario wherein I have to validate for null values in many JsonProperty if it is set as required=true. Here is the code snippet. public class JacksonValidator { private…
DMA
  • 1,033
  • 1
  • 11
  • 22