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
8
votes
2 answers

Apache Johnzon vs Jackson

since Apache released the first final version of Johnzon, it would be really interesting to see if there are already some comparison between Johnzon and FastXML Jackson to see if it is worth to switch. The most important topic is probably the…
smichel
  • 745
  • 1
  • 7
  • 14
8
votes
0 answers

Unable to convert Protobuf to map becasue of 'Direct self-reference leading to cycle' error

I am trying to convert a ProtoBuf to Map by using the below mentioned code. Map map = objectMapper.convertValue(obj, Map.class); Sample PB data causing this: id: "1" metadata { type: "UNIT" isValidated: false status { status: ACTIVE …
Rohith CM
  • 119
  • 6
8
votes
2 answers

Jackson ObjectMapper throwing NullPointerException even with NON_NULL

When the following JSON is used and either "phones" or "emailAddresses" are null, I'm getting a NullPointerException. JSON: { "item": { "messages": { "user.phone.missing": { "type": "warning", "key":…
ev0lution37
  • 1,129
  • 2
  • 14
  • 28
8
votes
1 answer

Is it possible to get the original field names of @JsonProperty?

I need to create a map of @JsonProperty Values to Original field names. Is it possible to achieve? My POJO class: public class Contact { @JsonProperty( "first_name" ) @JsonView( ContactViews.CommonFields.class ) private String firstName; …
7
votes
3 answers

JsonMappingException occurs while converting object to JSON string - org.apache.avro.AvroRuntimeException: Not an array:

While converting Java object to JSON string, I'm facing JsonMappingException. Below is the complete exception message. com.fasterxml.jackson.databind.JsonMappingException: Not an array:…
Nicolas
  • 554
  • 2
  • 11
  • 27
7
votes
1 answer

Can not construct instance of java.util.LinkedHashMap: no String-argument constructor/factory

Facing issues while parsing a file and converting into POJO. Below exception I am getting. com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of java.util.LinkedHashMap: no String-argument constructor/factory method to…
user6597131
  • 73
  • 1
  • 1
  • 4
7
votes
2 answers

Can't set ProblemHandler to ObjectMapper in Spring Boot

I tried to add custom problem handler to object mapper with Jackson2ObjectMapperBuilderCustomizer: @Bean public Jackson2ObjectMapperBuilderCustomizer customizer() { return new Jackson2ObjectMapperBuilderCustomizer() { @Override …
DamienMiheev
  • 998
  • 8
  • 31
7
votes
0 answers

Programmatically attach JsonSubType to JsonType

I have the following interface with a "type" JsonType and 2 subtypes associated with this. I have one more subtype to attach to this JsonType which cannot be added here. Is it possible to attach a subtype programmatically to this object from a…
seriousgeek
  • 992
  • 3
  • 13
  • 29
7
votes
1 answer

Object Mapper class use to store data in Core Data

Let start from background of my problem. I have a Person class which is used to parse JSON response class Person: NSObject, Mappable { var ID : String? var firstName : String? var lastName : String? convenience…
Usman Javed
  • 2,437
  • 1
  • 17
  • 26
7
votes
1 answer

ObjectMapper failed to serialize response

I am using AlamofireObjectMapper, whenever the response contains any null value, it gives an error, "FAILURE: Error Domain=com.alamofireobjectmapper.error Code=2 "ObjectMapper failed to serialize response."…
Aakash
  • 2,239
  • 15
  • 23
7
votes
1 answer

Custom Error Response Handling with Moya + RxSwift

I'm using Moya with RxSwift for networking in an iOS app, and I'd like to be able to consume my API's custom error responses when my Observers get calls to onError. The API always returns error responses in the following JSON format: { "error":…
Scott Storch
  • 794
  • 3
  • 9
  • 16
7
votes
1 answer

Realm Swift returning objects with all nil values

I am using ObjectMapper to parse JSON objects into Realm. My class Trip looks like this: class Trip: Object, Mappable { dynamic var Id : String? = nil dynamic var CreatedOn : String? = nil dynamic var LastModified : String? = nil …
Ashish Agarwal
  • 14,555
  • 31
  • 86
  • 125
7
votes
0 answers

Spring Boot : Use custom object mapper/message converter based on end points

I want to configure custom message converters based on endpoints. For example, I have below two endpoints in Spring boot controller: @RequestMapping(value = "/all", method = RequestMethod.GET) public ResponseEntity
Darshan Mehta
  • 30,102
  • 11
  • 68
  • 102
6
votes
3 answers

Throw error if strings are not double quoted while using jackson objectmapper deserialization

I have a JSON: { "stringField" : 1234, "booleanField": true, "numberField": 1200.00 } I use object mapper to deserialize the json into:- @Data class SomeClass { String stringField; boolean booleanField; float…
Jerald Baker
  • 1,121
  • 1
  • 12
  • 48
6
votes
3 answers

LocalDateTime is representing in array format

I am using spring boot 2.2.6 and Jackson 2.10.3 with Java 8. I am using localdatetime objects through out my project. Jackson is not able to parse LocalDateTime properly (or may be it's default format) and sending date in json response as in array…
Prabjot Singh
  • 4,491
  • 8
  • 31
  • 51
1 2
3
76 77