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
0
votes
0 answers

NoSuchMethodError using fasterxml jackson

I am getting this error when running a spring application and using a RestTemplate However when running a junit test I see no problem In my test I generate this json. [ { "idProcesoElectoral": 9, "idSolicitud": 591, "folioSiilnere":…
dabicho
  • 383
  • 4
  • 19
0
votes
1 answer

Jackson represent Java String as Json numbers or Strings

I have the following java class, say for example Employee class Employee{ String empId; } When I serialize this java class using Jackson Object Mapper, I get the sample Json output as, if the employee id is 123. { "empId":"123" } What I…
user1843883
  • 159
  • 1
  • 7
0
votes
1 answer

Accessing json property twice

Consider the following json document: { "a": { "one": "1", "two": "2" }, "b": { "three": "3", "four": "4", } } I need to deserizlize it to the below POJO : class Root{ @JsonAlias({"a","b"}) Node1 node1; …
Alexander.Furer
  • 1,817
  • 1
  • 16
  • 24
0
votes
1 answer

Serializing a POJO based on a runtime whitelist of properties

Is it possible to serialize a whitelisted subset of a POJO's properties (where the whitelist is known only at runtime) using Jackson? All the solutions I know of so far (Views, @JsonIgnoreProperties etc.) are static, compile-time solutions. Further,…
markvgti
  • 4,321
  • 7
  • 40
  • 62
0
votes
1 answer

A different ObjectWriter for each POJO to be serialized?

The code that quicktype.io generates makes a separate ObjectReader and ObjectWriter for each POJO that has to be [de]serialized. Is this a good practice (performance-wise) vs. using a single ObjectMapper for every class in a project (which is what I…
markvgti
  • 4,321
  • 7
  • 40
  • 62
0
votes
1 answer

public property overshadowed by public getter in json serialization

I have this weird scenario - I have this PlatformUser class that implements Principal getName() that returns its email. This is needed for authorization. I would like to be able to serialize and deserialize the PlatformUser based on the public…
Michail Michailidis
  • 11,792
  • 6
  • 63
  • 106
0
votes
1 answer

Jackson stream parser position

I am building a tool to parse huge JSON around 1GB. In that logic, I am creating JsonParser object keep reading till it reaches expected JsonToken. Now I create another JsonParser(called child), which should be starting from previous JsonParser…
Pokuri
  • 3,072
  • 8
  • 31
  • 55
0
votes
1 answer

Getting Undesired JSON response while using Jackson Provider

I'm currently facing an issue where the response from calling my web service implemented using Jersey 2 framework. Below the format of the response, I'm getting. { "rawType": "java.util.ArrayList", "type": { "actualTypeArguments": [ …
Yergalem
  • 1,603
  • 18
  • 14
0
votes
0 answers

Fasterxml Jackson convert json to java pojo

My application is consuming a third party API which produces a JSON response. I have mapped relevant pojo classes to the respective JSON responses. But I have a difficulty with mapping a particular response which has a property "message" that is…
Rakesh
  • 4,264
  • 4
  • 32
  • 58
0
votes
2 answers

jackson serialize by type with mixing?

I have a something like this as a json and need to convert it to a Java User-Instance by Jackson. "userid" : "1", "myMixes" : [ { "data" : { "id" : 1, "ref": "my-Object-instance" }, "type" : "object" }, { "data"…
nimo23
  • 5,170
  • 10
  • 46
  • 75
0
votes
0 answers

Spring doesn't consume a RESTful Web Service but deserialises the corresponding string properly, why?

I'm trying to consume a RESTful Web Service with Spring and my reference code is the one in this guide. The service that I'm interrogating returns JSON like the following: { "id": 1, "content": [ { "dependencies": [ { "parent": 0,…
Stefano Bragaglia
  • 622
  • 1
  • 8
  • 25
0
votes
2 answers

Vertx 3 - Java serializing large objects

Vertx 3 Newbie. I'm using the Java API. The usecase is for a reporting app which typically deals with large objects (POJOs). These POJOs contain the data to be exported into PDF, CSV etc and these are typically List of Maps. I'm wondering if I have…
user1189332
  • 1,773
  • 4
  • 26
  • 46
0
votes
1 answer

com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token

when deserializing below JSON, it fails with above exception message when trying to parse the server attribute which has its type 'string' nested within it, how to parse a JSON which is having the attribute types nested within each attribute like…
0
votes
1 answer

Jackson: Set class/object properties that are not coming from JSON when deserializing

I've got the following POJO: public class POJO { private final String id; private final String name; // constructor, getters omitted } And here's my JSON: { "name":"foo" } I get the id value from somewhere else in my code. I'd like to…
Benjamin M
  • 23,599
  • 32
  • 121
  • 201
0
votes
1 answer

Jackson blob exception

I am trying to save image to database, but I get error: org.codehaus.jackson.map.JsonMappingException: Can not construct instance of java.sql.Blob, problem: abstract types can only be instantiated with additional type information at [Source:…
kittu
  • 6,662
  • 21
  • 91
  • 185