Parse Json Java

I have a very weird json response in the following format (with many more attributes): { "foo": [ { "key": "name", "value": "Hans" }, { "key": "lastName", "value": "Peter" ...
more »

2017-04-19 18:04 (1) Answers

Make a configuration field required in Dropwizard

In a Configuration class for Dropwizard, if my yml file is missing a field, Dropwizard does not log anything nor throws any errors/exceptions. How can I make it throw an error and fail to start if the configuration file is missing a required configu...
more »

2017-04-19 02:04 (1) Answers

Generic Enum Json Deserialization

I needed a better hibernate enum mapping and this page served me well (Except I used char type instead of int): http://www.gabiaxel.com/2011/01/better-enum-mapping-with-hibernate.html Next question is how can I serialize/deserialize an enum in a gen...
more »

2017-04-18 08:04 (2) Answers

Rules due to Annotations with JSON and Spring

I have following JSON object {"type":"success","value":{"id":5,"quote":"Spring Boot solves this problem. It gets rid of XML and wires up common components for me, so I don't have to spend hours scratching my head just to figure out how it's all piec...
more »

2017-04-15 11:04 (0) Answers

Invalid UTF-8 middle byte 0x72

I am using JsonSerializer and JsonDeserializer in spring-kafka to set the value serializer while producing a message. The message has one field(orgName)with a special character in it (german umlaut).How do I handle this special character? I know Json...
more »

2017-04-14 21:04 (0) Answers

Spring boot deserialization for two models

I want to deserialize json into two models which are not related, after some research about custom deserialization in JACKSON I cannot see how I can do it? I know I can solve the issue by creating a wrapper model for the two models but isnt there a ...
more »

2017-04-14 20:04 (1) Answers

a string member is not deserialized as expected

I have this json "staff=true":{"is_dup":false,"weight":600,"active":true,"comment":"","state":"pushed","value":"linqmap.proto.voice.VoicePrompts$VoicePromptsConfig { \\\nprompts {\n id: \"eng_arnold_schwarzenegger\"\n name: \"Terminator\"\n lang:...
more »

2017-04-13 23:04 (0) Answers

Spring Boot Jackson and Data serialization

In my Spring Boot application I use a following DTO with @RestController: public abstract class ComparableQuery extends BaseQuery { private final Object value; ... } Everything works fine but when I use Spring RestTemplate and pass java.uti...
more »

2017-04-13 15:04 (1) Answers

Custom Jackson deserializer ignored: EJB3

After spending hours on end on this, I'm finally relenting and asking this question: I'm implementing a typical EJB3 project with JPA2 and Jersey. The JSON parser is Jackson. No matter how many permutations I try, my custom deserializer is ignored. ...
more »

2017-04-13 07:04 (0) Answers

Deserialise Json into nested pojo's

There seem to be a few similar questions but I can't quite seem to find an answer ? I am trying to parse the json returned by a jqGrid filter property in a controller. To get it working I'm doing it in a very clunky way although once I have it work...
more »

2017-04-12 23:04 (1) Answers

Jackson deserialize JSON with timestamp field

I have such string: { "debug":"false", "switchTime":"2017-04-12 17:04:42.896026" } I'm trying to get object in such approach: new ObjectMapper().readValue(string, MyObject.class); And MyObject class: class MyObject { private Boolean...
more »

2017-04-12 17:04 (3) Answers

Pass method's generic as generic class generic

I'm querying JSON object from a service, where pagination is being used. I wanted to create a generic class, and a generic method where the values are decoded to the corresponding type, then I ran into a problem where I couldn't pass the method's gen...
more »

2017-04-12 15:04 (1) Answers

Jackson + Autovalue Builder bean validation

I have a the following Event DTO class: @AutoValue @JsonDeserialize(builder = AutoValue_Event.Builder.class) @JsonIgnoreProperties(ignoreUnknown = true) public abstract class Event { public static Event.Builder builder() { return new Au...
more »

2017-04-12 10:04 (0) Answers

Coordinate DataType for Operation in Jackson

I have the collection of tweets in a json file. I want to do operations on them such as grouping tweets based on the time and coordinates that each data entry have. currently for the object coordinates I have them in List data type. Similar with the ...
more »

2017-04-12 07:04 (1) Answers

Java servlet and persistence structure

I have a java webapp that has a servlet doPost which accepts some json POST. Lets call it a "Person". So it receives something like { name: "Joe", age: 35 }. Then there's also a databind class for jackson that captures this... like public class Per...
more »

2017-04-11 19:04 (1) Answers