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

ObjectMapper - nested dynamic keys

I'm writing in Swift 3.1, using ObjectMapper to map my JSON response to my models. I'm trying to map this rather complex JSON response with dynamic keys and am hoping to get some feedback on what I'm doing wrong. A group has statistics about it's…
5
votes
4 answers

Alamofire response object mapping

I am an android developer new to swift 3 programming, I am using Alamofire for making api calls and to avoid tedious json paring I am using AlamofireObjectMapper library. I have a ApiController which has a function to make api calls below is the…
Syn3sthete
  • 4,151
  • 3
  • 23
  • 41
5
votes
1 answer

Jackson ObjectMapper set JsonFormat.Shape.ARRAY without annotation

I need to use two jackson 2 object mappers. Both mappers work with the same set of classes. In the first I need to use standard serialization. In the second i want to use ARRAY shape type for all classes (see…
5
votes
1 answer

Mappting Alamofire responseJSON via ObjectMapper

Note: I need to use ObjectMapper, and not AlamoFireObjectMapper. How do you map without going to JSON but from responseJSON data to map to User? The following is trying to go from responseJSON to jsonn and then back again to data(being User). I…
Chris G.
  • 23,930
  • 48
  • 177
  • 302
5
votes
2 answers

DynamoDBMapper: How to get saved item?

For a simple Java REST-API I created a save function to persist my model to a DynamoDB table. The model uses a auto generated range key as you can see here: @DynamoDBTable(tableName = "Events") public class EventModel { private int country; …
5
votes
1 answer

Convert json to Object List

I have the following String: String json = "[{\"id\": \"0\", \"ip\": \"123\", \"mac\": \"456\"}, {\"id\": \"1\", \"ip\": \"111\", \"mac\": \"222\"}]"; And a SlaveEntity Entity that has: public class SlaveEntity extends BaseEntity { private…
Cristian
  • 1,590
  • 5
  • 23
  • 38
5
votes
0 answers

Error handling with AlamofireObjectMapper vs Alamofire + ObjectMapper

Currently I'm Using Alamofire + ObjectMapper. I want to use AlamofireObjectMapper instead. But i have 1 issue: how to deal with api-content-level error? for example when i try to save a new user: if all details i sent to the server are valid so my…
Eyal Ben Yehuda
  • 219
  • 3
  • 17
5
votes
1 answer

How to exclude fields in ObjectMapper during serialization?

So I have a simple class like the following: class User: NSObject { var name = "" var phoneNumber = "" override func mapping(map: Map) { super.mapping(map) name <- map["name"] phoneNumber <- map["phoneNumber"] …
Julian B.
  • 3,605
  • 2
  • 29
  • 38
5
votes
1 answer

How to map a JSON dictionary in ObjectMapper?

I have json data that looks like this: { "balance": { "pointsEarned": 3, "pointsAvailable": 3, "pointsOnHold": 0, "pointsConsumed": 0, "nextReward": 6 } } I'm trying to map the "balance" so I can get the other values: class…
SwiftyJD
  • 5,257
  • 7
  • 41
  • 92
5
votes
1 answer

Map JSON to array of my model - ObjectMapper

I am having the trouble in mapping json to my objects array with ObjectMapper. Here is my model object. class Participant : Mappable { var user_global_id: String! var user_app_id: String! init(){ } required init?(_ map: Map) { } // Mappable func…
5
votes
1 answer

How to ignore certain fields with Jackson's ObjectMapper.readerForUpdating

I'm using Jackson 2.7.0 I'm trying to ignore encodingType when updating an existing object with some new values: ObjectMapper om = new ObjectMapper(); om.readerForUpdating(message).readValue(messageSubset); message contains a value for…
Thomas Stubbe
  • 1,945
  • 5
  • 26
  • 40
5
votes
5 answers

Alamofire, Objectmapper, Realm: Nested Objects

I'm using Alamofire, Objectmapper, Realm and everything is working beside one thing: I can't map nested objects. class Voting: Object, Mappable { dynamic var votingID: String = "" dynamic var question: String = "" var votingOptions =…
netshark1000
  • 7,245
  • 9
  • 59
  • 116
4
votes
1 answer

Is it possible to customize ObjectMapper for single Spring Rest endpoint?

I know how to customize the default ObjectMapper bean. But for one specific Controller/endpoint, I'd like to use a different objectmapper. How can I do this? I think my question is similar to this one but there are no answers yet. Happy to get an…
kane
  • 5,465
  • 6
  • 44
  • 72
4
votes
1 answer

io.mockk.MockKException: no answer found when mocking list of objects with ObjectMapper.readValue() using mockk?

There were similar questions but none dealing specifically with kotlin, mockk and using objectMapper.readValue to read a list of objects. Given a method: fun someMethod(message: Message): List = objectMapper.readValue( …
Naruto Sempai
  • 6,233
  • 8
  • 35
  • 51
4
votes
1 answer

Parsing JSon String using json node

i have a normal json string to parse : "name":"Jake", "salary":3000, "phones":[{"phoneType":"cell","phoneNumber":"111-111-111"}, {"phoneType":"work","phoneNumber":"222-222-222"}], "taskIds":[11,22,33], "address":{"street":"101 Blue…
kan zied
  • 91
  • 8