Skip to content

Tag: jackson

Deserializing non-string map keys with Jackson

I have a a map that looks like this: My verb class looks like this: I want to serialize and deserialize instances of my VerbResult class, but when I do I get this error: Can not find a (Map) Key deserializer for type [simple type, class my.package.Verb] I read online that you need to tell Jackson how to deser…

Jackson overcoming underscores in favor of camel-case

I retrieve a JSON string from internet; like most JSON I’ve seen it includes long keys that are separated by underscores. Essentially, my goal is to deserialize JSON into java-objects, but I don’t use underscores in java-code. For instance, I might have a User class with firstName field in camel-c…

How to use Jackson to deserialise an array of objects

The Jackson data binding documentation indicates that Jackson supports deserialising “Arrays of all supported types” but I can’t figure out the exact syntax for this. For a single object I would do this: Now for an array I want to do this: Anyone know if there is a magic missing command? If …

Converting JSON data to Java object

I want to be able to access properties from a JSON string within my Java action method. The string is available by simply saying myJsonString = object.getJson(). Below is an example of what the string can look like: In this string every JSON object contains an array of other JSON objects. The intention is to …