Skip to content
Advertisement

Tag: jackson

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

Deserialize empty JSON array into empty TreeMap

I’m new to Java, and I’m wondering how to deserialize an empty JSON array into an empty Java object of type TreeMap<String, MyOtherClass>. Currently, I’m attempting to deserialize a JSON file with an array of objects, and each object into a class called MyClass. The class is roughly as follows: One of the entries in the original JSON is this

Ktorm entities as springboot controller parameters

I’m trying to use Ktorm in my new springboot application, and get myself into problem when trying to use Ktorm entities interfaces as springboot controller parameters. The entity and Controller look like this: I got this exception once calling function addTask(): [HttpMessageConversionException] Type definition error: [simple type, class website.smsqo.entity.Task]; nested exception is: [com.fasterxml.jackson.databind.exc.InvalidDefinitionException] Cannot construct instance of website.smsqo.entity.Task (no Creators,

How to convert an input into a method that the program will understand

I’m currently working on my homework about client and server topic: I created a class called VehileRequest.java which will take three variables (year, make, model) from Client.java and pass them to Server.java then the Server will get information from VehicleRespone.java and display the information about price, miles vv… As I understand, the program didn’t recognize the request that pass to

Advertisement