How to unwrap object into a list when deserializing

I’m trying to create json that looks like this "entries" : [ { "name" : <name>, "dataPoint" : [ [long, double], [long, double], ] } ] Each data point is a 2-element array of a long and a double If I have this public class Entry { private String name; private List<DataPoint> dataPoint; <constructor and… Read More How to unwrap object into a list when deserializing

Query on Java Jackson Implementation

I have a json file in below format: { "resources" : { "foo" : { "value" : "test" }, "bar" : { "value" : "test" } } } And, I have created it’s JAVA Class as below: package org.example.model; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.HashMap; import java.util.List; public class JsonTwoJavaFileModel { @JsonProperty("resources") private HashMap<String, HashMap<String, List<String>>> stringListHashMap;… Read More Query on Java Jackson Implementation

Modify JSON AST whilst deserializing without annotations

I’m trying to write some code that will deserialize JSON into somebody elses class. That is, I don’t own the target class so I can’t annotate it. In particular, this class has some helper methods that are complicating the deserialization process. Something like this: class Result { private List<String> ids; public List<String> getIds() { return… Read More Modify JSON AST whilst deserializing without annotations

Getting the values of a specific key from JsonNode

I have a JsonNode result represented as: [ { "item": { "type": "uri", "value": "http://www.wikidata.org/entity/Q42442324&quot; }, "prop": { "type": "uri", "value": "http://www.wikidata.org/prop/direct/P21&quot; }, "itemLabel": { "xml:lang": "en", "type": "literal", "value": "Kiisu Miisu" } }, { "item": { "type": "uri", "value": "http://www.wikidata.org/entity/Q43260736&quot; }, "prop": { "type": "uri", "value": "http://www.wikidata.org/prop/direct/P21&quot; }, "itemLabel": { "xml:lang": "en", "type": "literal",… Read More Getting the values of a specific key from JsonNode

JSON returns one field with ID and other field with full object, when both objects are same

I have a class like below. @Getter @Setter @AllArgsConstructor @NoArgsConstructor @EqualsAndHashCode @Entity @Table( name = "hires", indexes = { @Index( name = "idx_hire_date", columnList = "date DESC" ) }, uniqueConstraints = { @UniqueConstraint( columnNames = { "vehicle_id", "po_number" } ) } ) @DynamicUpdate @JsonIdentityInfo( generator = ObjectIdGenerators.PropertyGenerator.class, property = "id" ) public class Hire implements… Read More JSON returns one field with ID and other field with full object, when both objects are same