Use JSON object as key in Java Map

Can i use json object as key in java maps. Following is want i am looking for: Map Object1 = { "Key1": "Value1"} Object2 = { "Key2": "Value2" } So that when i print map it should return { "Key1": "Value1"} : { "Key2": "Value2" } Here key and...
more »

2017-01-13 15:01 (0) Answers

Jackson JavaTimeModule for Joda Time?

I would like to set global Jackson serialization setting for Local Date and use something like JavaTimeModule for java.time but for JodaTime's Local Date. Does something like JavaTimeModule exist for Joda Time? ...
more »

2017-01-13 10:01 (1) Answers

Wildfly 10 and Jackson 2

I have problem like Jackson 2 on Wildfly 10: How to load ProviderBase? All dependecies in maven - provided jboss-deployment-structure Is it right? <deployment> <dependencies> <module name="by.lib" meta-inf="export" expo...
more »

2017-01-12 11:01 (1) Answers

Mapping JSON with multiple entries to an array

I have a JSON file with multiple entries that have same attribute names, but different attribute values, such as: { "name" : { "first" : "A", "last" : "B" }, "gender" : "MALE", "married" : false, "noOfChildren" : 2 }, { "name" : { "first" ...
more »

2017-01-12 10:01 (2) Answers

Use JsonParser again after deserialization

I'm trying to extend the Jackson default deserialization to assign a placeholder object to the fields of my domain object when they are set to null explicitly in the json. I'm using Spring Boot + Spring Data. I searched a lot for the best way to do i...
more »

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

Maximum size of Json handled by Jackson

Is there a limit to the size of JSON file which can be handled by Jackson? My JSON can be huge. Simple example: { "people": [ { "Name": "John Smith", "number": "123-456-789" }, {MILIONS OF OTHER PEOPLES} ], "cars": [MIL...
more »

2017-01-11 16:01 (1) Answers

How to bypass @JsonIgnore annotation?

I am trying to create a rest end point and using Swagger as UI representation. The pojo which I'm using it has a variable annotated with @JsonIgnore as shown below. @JsonIgnore private Map<String, Object> property = new HashMap<String, Obj...
more »

2017-01-11 11:01 (1) Answers

Disabling Some Jackson Serializing Efficiency

I have an Entity with four @OneToOne mappings to the same Entity: @Entity @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id", scope = TaxTable.class) public class TaxTable extends BaseEntity { @OneToOne( f...
more »

2017-01-09 18:01 (0) Answers

Configure deserialize Json in RestAssured

I use restAssured to test rest service in our applications. The application receive a Json format. Before call the rest service, RestAssured must deserialize a field (ENUM) of bean class with toString method to achieve the response. Follow the code:...
more »

2017-01-09 18:01 (1) Answers

How to add a method to parse a JSON file in Java

I am trying to parse the content of JSON file text.json by using Jackson library. What I want is to make a java method in the following code to get all keys and values of it, but so far in my code I get only the first key and the first value of the ...
more »

2017-01-09 13:01 (2) Answers

Parsing an array of long using jackson

I am getting the following error while calling my http method.(Spring boot application) "JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token". Its a DELETE call and I am passing my JSON as given...
more »

2017-01-09 10:01 (1) Answers

How to deserialize an Avro file using Jackson?

Avro can store batches of serialized object in a single file ("object container file"). Avro supports deserialization to avro-generated java classes or to java bean-style objects, which are both too restrictive in my opinion. I'd love to use Jackson ...
more »

2017-01-08 20:01 (0) Answers

Customizing enum constant names with Jackson

I have an enum defined as public enum Locale { EN_US, ES_MX } These locale, however, are written as lowercase strings with hyphen as en-us and es-mx in data. Is there a way to map these lowercase strings to corresponding enum constants? Like en...
more »

2017-01-06 23:01 (1) Answers

Jackson: Serializing object fields to array

I'm pretty new to Jackson, but I stumbled upon the following problem: I'd like to serialize a simple object to an array of its fields. So considering the following class: public class UserModel { private String id; private String firstName;...
more »

2017-01-06 13:01 (3) Answers

Jackson - cannot serialize generics

Here is my class hierarchy: Banana class: @JsonTypeName("banana") @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type") public class Banana<T, M> extends Fruit<T, M> { Fruit class: @JsonTyp...
more »

2017-01-06 13:01 (2) Answers

Jackson Mapping List of String or simple String

I'm trying to get some Json from an API and parse them into some POJO's to work with them but i have this case where i can get for a key a simple String or an arrayList of Strings. The Json looks like this : { "offerDisplayCategoryMapping": [ ...
more »

2017-01-06 12:01 (3) Answers