Questions tagged [objectmapper]

ObjectMapper is a library for simple JSON object mapping in Swift.

ObjectMapper is a library for simple JSON object mapping in Swift.

1145 questions
3
votes
1 answer

Serialize JSON date format from ZonedDateTime to custom date format using ObjectMapper

ObjectMapper doesn't format ZonedDateTime object to customized one. POJO is not under my control so that I can't change it. I need to serialize POJO object for WS. POJO has ZonedDateTime (I don't know why because it's date is from database). I am…
3
votes
4 answers

Converting a Map to a Value type with Jedis

So, I have a value type : class Session { long createdAt; List postIds; } Using the jedis client(3.0.0-m1 is that matters), I am currently performing an hset to create the entries and hgetAll to retrieve all the key-values: private…
Naman
  • 27,789
  • 26
  • 218
  • 353
3
votes
2 answers

How to map dictionary with dynamic keys with ObjectMapper?

I'm new to ObjectMapper. I have response from the server: { "123123": 10, "435555": 2, "435333": 8, "567567": 4 } Keys (dynamic) are going to be IDs. Values are going to be COUNT. How can I map it with ObjectMapper? My code…
instback
  • 131
  • 2
  • 15
3
votes
1 answer

Handling JSON pagination, and adding data to a table view?

I'm getting a JSON response of the format: { "current_page":1, "data":[ { "id":1, "title":"Title 1" }, { "id":2, "title":"Title 2" }, { …
user6724161
  • 195
  • 2
  • 15
3
votes
1 answer

ObjectMapper can't handle mapping object with legacy enums (classes)

I'm having an issue with building REST architecture for some legacy code. Jackson ObjectMapper is unable to map my custom object to legacy object, because of 'enums' that really are classes with static final fields. I tried implementing custom…
mklepa
  • 211
  • 3
  • 7
3
votes
3 answers

Convert json to Java Object - Properties set to Null

I am trying to convert a Json to a Java object.I have a String named 'result' and I want to Convert it into a Java Object whose class is TransferRecord.java This is a part of the string I use as the input. { "TransferRecord": { "TransferId":…
Supun Amarasinghe
  • 1,443
  • 3
  • 12
  • 24
3
votes
2 answers

Mapping Generic API Response Using Codable or ObjectMapper

I am facing a challenge regarding mapping a generic api responses against a model class using codable or object mapper. Suppose I have these api responses against different apis. { "code" : 0, "http_response" : 200, "success" : true, …
Muhammad Awais
  • 340
  • 3
  • 15
3
votes
1 answer

Custom BigInteger JSON serializer

I am trying to implement a custom JSON serializer class to display object BigInteger values as string in the JSON response. I have implememented a custom serializer class public class CustomCounterSerializer extends StdSerializer { …
Ilias Ele
  • 33
  • 5
3
votes
3 answers

How to use different JSONProperty on Serialize & Deserialize using Jackson API?

I had a Java object "Author" which was then restructured to become an Ararylist of "Author". Author object was saved in DB directly as JSON below: {"author":{"id":1,"recordId":0}} So my earlier Java Field was : private Author author = new…
usman
  • 1,351
  • 5
  • 23
  • 47
3
votes
1 answer

ObjectMapper removed fields without value during converting an object to dictionary

I used ObjectMapper to map JSON to object and vise versa, I want to convert an object to JSON, but when I try converting the object to JSON, the fields without value, will be deleted from JSON, for example: class Provider: NSObject, Mappable { …
Hamed
  • 1,678
  • 18
  • 30
3
votes
1 answer

ObjectMapper: Using reflection in map function

I am using ObjectMapper for a while and I find it cumbersome to write map function for classes with lots of property by using the way described in documents: func mapping(map: Map) { username <- map["username"] age <- map["age"] …
Olcay Ertaş
  • 5,987
  • 8
  • 76
  • 112
3
votes
7 answers

No serializer found when serializing one Object

I'm trying to return an Object as JSON. Using the /user/id endpoint, I want to display a User based on his Id. When calling this controllerMethod I get the following Exception: InvalidDefinitionException: No serializer found for class…
xtra
  • 1,957
  • 4
  • 22
  • 40
3
votes
3 answers

Autowire ObjectMapper in Springboot application

I need to use default ObjectMapper inside my Spring-boot application as a singleton instance. Can I simply @autowire the ObjectMapper(Which instance created by default in Spring-boot application) inside my application without creating a @Bean(As I…
Udara Gunathilake
  • 202
  • 1
  • 2
  • 14
3
votes
1 answer

ObjectMapper using TypeReference not working when passed type in generic method

This is the method: protected TestPageResult getTestPageResutForRequest(MockHttpServletRequestBuilder request) throws Exception { String responseJson = mockMvc.perform(request).andReturn().getResponse() …
ivan
  • 307
  • 3
  • 12
3
votes
0 answers

Formatting java.time.Instant bean property in springboot 1.5.3 and jaxrs

I'm using Jaxrs, to create Rest services with springboot 1.5.x. I have a bean with an Instant property. When I call my service instead of getting { "startTime": { "epochSecond": 1517243670, "nano": 986000000 } } I would like…