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
12
votes
1 answer

cannot be resolved to a type?

I want to convert a json string to a List using jackson json library. public static List toList(String json, Class type, ObjectMapperProperties objectMapperProperties){ ObjectMapper objectMapper =…
Siddharth Trikha
  • 2,648
  • 8
  • 57
  • 101
12
votes
2 answers

ObjectMapper cannot be resolved to a type

I have troubles getting JSON to work. ObjectMapper cannot be resolved. Library is imported correctly. import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import…
Jürgen K.
  • 3,427
  • 9
  • 30
  • 66
11
votes
1 answer

java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/TSFBuilder

I'm using maven and dropwizard, getting java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/TSFBuilder error when I initiate an Object Mapper. Tried to override the dependency by adding com.fasterxml.jackson.core version 2.10.0 to POM (also…
roe
  • 299
  • 1
  • 3
  • 10
11
votes
1 answer

LocalDate Serialization: date as array?

I use Java 11 and want to serialize/deserialize LocalDate/LocalDateTime as String. Okay. I added dependency: com.fasterxml.jackson.datatype jackson-datatype-jsr310
11
votes
2 answers

How does Jackson ObjectMapper transfer byte[] to String and how can I translate it without object class?

I would like to develop restful service and it will return JSON String to client. Now there is byte[] attribute in my object. I use ObjectMapper to translate this object to json and response to client. But I find the byte[] is wrong if I use…
Ringing.Wang
  • 123
  • 1
  • 1
  • 5
10
votes
1 answer

Using DateTimeFormatter with ObjectMapper

Prior to Java8, we used to set DateFormat with ObjectMapper as follows DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); ObjectMapper mapper =…
DanglingPointer
  • 261
  • 1
  • 6
  • 19
10
votes
1 answer

Error Domain=NSCocoaErrorDomain Code=3840 "No string key for value in object around character 1."

This is the json string returned from a server. I am trying to Map it to a object mapper class and print values but I get the following error. Error Domain=NSCocoaErrorDomain Code=3840 "No string key for value in object around character…
user6587892
9
votes
1 answer

Creating new instance of object implementing Mappable interface

I am using ObjectMapper library to convert my model objects (classes and structs) to and from JSON. But sometimes I would like to create objects without JSON. Supposse, I have class like this: class User: Mappable { var username: String? var…
David Silva
  • 1,939
  • 7
  • 28
  • 60
9
votes
4 answers

ObjectMapper how to map different object based on JSON

I'm using ObjectMapper (https://github.com/Hearst-DD/ObjectMapper) to map my JSON to Swift objects. Say I have this JSON structure: { animals: [ { "type": "Cat", "weight": 23, "catchMice": true }, { "type":…
7ball
  • 2,183
  • 4
  • 26
  • 61
9
votes
2 answers

Compound key issue Realm Swift

I am trying to store json object to realm object using Objectmapper after I receive response from Alamofire. Below is the code I have written: func getTodayData() { Alamofire.request("https://myapipoint.json").responseJSON{ (response) in …
amagain
  • 2,042
  • 2
  • 20
  • 36
9
votes
4 answers

Swift and ObjectMapper: NSDate with min value

I'm using ObjectMapper to cast json into objects. My problem is that the NSDate property is not being mapped correctly. Here is the json: { "Id":4775, "Cor":{ "Id":2, "Nome":"Amarelo", "HTMLCode":"FFFB00" }, …
André Luiz
  • 6,642
  • 9
  • 55
  • 105
9
votes
3 answers

How to map a realm list of custom objects using Mappable protocol in Swift

In my Realm object model I have an object called "Event". Each Event has a list of EventLocatons. I am trying to map these object from json, but the list of EventLocations is always empty. The objects look like this (simplified for clarity): class…
hmitkov
  • 359
  • 4
  • 12
9
votes
4 answers

Convert a List of json object to hashmap using jackson

Is there a way to use inbuilt Jackson capabilities to convert a list of json object to HashMap using java Explanation: Json structure that i need to parse { list:[ { keyId : 1, keyLabel : "Test 1", …
Ysak
  • 2,601
  • 6
  • 29
  • 53
8
votes
1 answer

Can not deserialize instance of java.util.LinkedHashMap out of START_ARRAY token

Below mentioned is the JSON string, resultString: { "imageMaps": [{ "crc": "c2c4", "flags": "0", "length": "117384", "index": 1, "version": "1.1.90ea", "status": "" }, { "crc": "7601", …
Random Coder
  • 329
  • 2
  • 5
  • 11
8
votes
2 answers

Jackson Java to JSON object mapper modifies field's name

Using Jackson to convert a Java object to JSON ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(Include.NON_NULL); jsonMessage = mapper.writeValueAsString(object); the result is that the field "participants" (which is…
heeboir
  • 729
  • 1
  • 9
  • 26
1
2
3
76 77