Skip to content
Advertisement

Tag: jackson

Json deserialization Java

i have a simple question, let’s say I have this json Mapped this way: I was wondering if it was possible to just save an outer field in the inner object like this by using some custom setter/annotation or something: PS: using a custom deserialization is my last resort due to the complexity of the json Answer If anyone was

Spring, Jpa : One To Many Error when the list contains values

I want to return a Profile Object in JSON containing a list of login details associated with a social network. Everything works correctly when the “reseaux_sociaux” table is empty. For my status table I get my statuses in JSON format in my Profile object. However, when “reseaux_sociaux” contains values then I get the error below and my Profile object in

How to compare nested JsonNode field values with Java object parameter values in DROOLS?

I’ve been trying to execute a set of rules on a request object on the basis of some set of configuration value. Below is the example on what I am trying to do: Configuration: config.json Request Class Object: policyDataToBeVerified I converted the config.json into a JsonNode object:configJson and passed both policyDataToBeVerified and configJson to drools working memory. Below are the

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?

Streaming large JSON from input stream efficiently in Java

In order to save memory and avoid an OOM error, I want to stream a large JSON from an input stream and extract the desired things from it. More exactly, I want to extract and save some strings from that JSON: files.content.fileContent.subList.text = “some text in file” files.content.fileContent.subList.text = “some text in file2” and save them into a String variable:

How to conditionally serialize a field

I want to conditionally serialize a field. I figured out how to conditionally ignore a field with But what I really want to do is to redact the field. So if I have I get Field2 is correctly ignored. But what I really want is I have another annotation, @MaskSensitiveData So what I want to do is combine them. So

format a json of a class in spring

I am new with spring and I want the json response of my class public class Mapping { public String name; public Object value; } be changed from {“name” : ‘value of field name’, “value”: ‘value of field value’} to {‘value of field name’ : ‘value of field value’} I tried @JsonValue and @JsonKey but they didn`t work. how can

Using Set instead of List cause “Could not write JSON: Infinite recursion” exception

I was getting the error “Could not write JSON: Infinite recursion” when trying to access the endpoint http://localhost:8080/categoryOfPermissions. I’ve researched and found various solutions here (@JsonManagedReference / @JsonBackReference, @JsonIgnore, @JsonIdentityInfo), but none of them seemed to work. Finally, I found an answer stating that it was necessary to change from Set to List, in order for the @JsonIdentityInfo solution to

Advertisement