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
4
votes
1 answer

Jackson JsonNode Serialization

I'm using AWS Lambda with a Java 8 function. Lambda has a builtin Jackson Serializer so when your method returns an object it serializes it to a JSON representation. I have an object that is made up of the following properties: private String…
tarka
  • 5,289
  • 10
  • 51
  • 75
3
votes
2 answers

Jackson: add suffix according to a field type

Here my POJO: public class AutorDenormalized { private String id; private Long unitatId; private String grupId; private String descripcio; public AutorDenormalized() { } // getters $ setters } I'd like to serialise…
Jordi
  • 20,868
  • 39
  • 149
  • 333
3
votes
1 answer

Polymorphic deserialization of jackson using parent property value

I have a json as follows: { "transformationRules": [ { "targetFieldName": "pageUrlNumber", "inputPath": "$.metadata.pageUrl", "rules": [ { "name": "regex", …
bigbounty
  • 16,526
  • 5
  • 37
  • 65
3
votes
1 answer

JACKSON: How to ignore the POJO name while converting a POJO to JSON using Jackson?

I am using Jackson 2.10.1 library to convert my Java POJOs to JSON and I am getting the below output, I require the output without the POJO name(MyTestPojo here), I have tried various jackson annotations like @JsonIgnoreProperties but those are…
3
votes
5 answers

jackson disable @JsonFormat annotation

I am using jackson library and I have came across a situation where I want to disable @JsonFormat annotation using objectmapper while serialization/deserialization. My Api code is in 3rd party library so i can't remove/add any annotation, so…
3
votes
1 answer

Remove association links for content on collection resource for Spring Data REST

How configure Spring Data REST to remove entity association links (left only "self") on Collection resource response of Repository interface endpoints, without set exported=false on @ResResource annotation (need keep exported the endpoints) We has…
pdorgambide
  • 1,787
  • 19
  • 33
3
votes
1 answer

Custom Jackson deserialization - getting com.fasterxml.jackson.databind.exc.MismatchedInputException: Unexpected end-of-input when binding data

I'm trying to write a custom deserializer for an Object that's type aware (TypeAwareObject in code below). I'm getting the following error: com.fasterxml.jackson.databind.exc.MismatchedInputException: Unexpected end-of-input when binding data into…
akk202
  • 194
  • 1
  • 10
3
votes
4 answers

How to enable 'ALLOW_NUMERIC_LEADING_ZEROS' feature to allow leading zeroes in JSON Request Body?

As per JSON specification, I am aware that leading zeroes are not allowed in integers in JSON. But as per Jackson documentation, there is a property in Jackson library i.e. ALLOW_NUMERIC_LEADING_ZEROS which when enabled, does not throw exceptions…
user
  • 383
  • 1
  • 5
  • 20
3
votes
0 answers

Jackson error - Caused by: java.lang.VerifyError: Bad type on operand stack

I am getting thie below excepetion in Jackson running on JBOSS Wildfly 8.2. My Jackson versions are below. The same versions are used in the module as well. com.fasterxml.jackson.core
Debadatta
  • 689
  • 1
  • 8
  • 23
3
votes
3 answers

Wrapping Json fields into instance variable of a pojo

i am trying to map certain json fields to a class instance variable. My sample Person class looks like: public class Person { private String name; private Address address; //many more fields //getters and setters } The sample…
user2083529
  • 715
  • 3
  • 13
  • 25
3
votes
2 answers

What does JsonFormat.Shape.NUMBER_INT serialize for LocalDate?

Consider example: public class MyDto { @JsonFormat(shape = JsonFormat.Shape.NUMBER_INT) private LocalDate dob; } Leads to {"dob":17918} when new Date().getTime() return 1548155501766 It does not look like seconds or milliseconds. So What is…
Cherry
  • 31,309
  • 66
  • 224
  • 364
3
votes
1 answer

Remove jsonnode which contains a specific word

I have generated below Json using Jackson lib in Java: { "name": "name1", "version": "0.0.1", "storage": { "db": { "test_field1": "STRING", "t_dlm1": "STRING", "test_field2": "STRING", …
Ron
  • 51
  • 3
3
votes
4 answers

Spring Batch not deserialising dates

I'm adding an object in the JobExecution context of spring batch, which contains an Instant field. It's getting serialised as follows: { "startFrom": { "nano": 0, "epochSecond": 1541116800 } } However, Spring Batch doesn't seem to be…
Nicolas Widart
  • 1,187
  • 4
  • 13
  • 30
3
votes
2 answers

Jackson -- parse json using xpath or similar

I have some json and it's fairly complex -- (a bit too complex and open-ended to model using something like gson), and I need to extract string values from certain nodes into a list of strings. The following code works, but due to the way my json…
A_Elric
  • 3,508
  • 13
  • 52
  • 85
3
votes
2 answers

How to write to raw string with jackson 2

I want to write an object to a raw json String. for example i have one class class Tiger{ String name; int age; } Tiger tiger = new Tiger("red", 12); Then i use ObjectMapper of jackson to write it to string ObjectMapper objectMapper =…
shinobitiger310
  • 175
  • 1
  • 7