Skip to content

Tag: jackson-databind

How to deserialize JSON with @JsonCreator and @JsonGetter

I have the JSON looks like the following: and I have a class Person: I need to deserialize and serialize it, but when I’m trying to deserialize this JSON I get unexpected result. Why when I’m trying to deserialize it the @JsonGetter annotation is used for it? How can I disable @JsonGetter annotation when I try to deserialize the JSON?

How to read value from JSON with Jackson Java

I have a JSON file: I want to get the items separately. I try to do, but the result did null: This is class for Items: What I do wrong? how correctly read value from items? Answer You didn’t handle the JSON array – items – properly, so as I commented under OP, all what you need to do is

@JsonIdentityInfo serialization of items

I’m trying to serialize relations using @JsonItentityInfo to avoid circular references. I’ve created a test to try test the result of the serialization, and I’ve found that jackson is not behaving as I expected. The serialization in not what I though it would be and, in fact, when I try to desarialize the serializated object, an exception is thrown. The

How to merge two jsonNodes in one

I have two variables of class User as follows: I want to create a JsonNode with the following structure: I have converted the objects to nodes, but I do not know how to merge them using Jackson. Or is there a more efficient way to create one json node structure with the two classes ? I am using Kotlin and

JSON data mapping in Java with Jackson

I got stuck in mapping a json into my data structures “the easy way” using just Jackson decorators and I was wondering if there is a way to do this … The json that I try to read has the following structure: So basically every data entity has a “data_info” object (mapped in my code from below to DataTypeInfo) that