Skip to content

Tag: jackson

Jackson subtypes – how to specify a default

I want to do something like this with subtypes. I have 3 different types of objects: value can either be a string or an object. The corresponding Java classes are I don’t mind having a discriminator inside Obj1 and Obj2, but there is no place for one when the value is just a string. Is there a way that …

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…

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 de…

How to deserialize json to nested custom map via gson?

I have the following json To deserialize it, I have the following data model class. I am not getting any deserialization error when I am using gson but the profiles variable is coming as null. This is how I am deserializing. var json = gson.fromJson(data,json.class) inside the match object there can be a dyna…

Jackson deserialise JSON with many dynamic nodes

I’m trying to deserialize a JSON file with the format of But I don’t want to create a class for each language (thousands) so I wrote a custom LanguageDeserializer which gives me back the List<Language> that I want I have a parent class to wrap the results: So when I try and use it The langua…