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
77
votes
7 answers

How to set format of string for java.time.Instant using objectMapper?

I have an entity with java.time.Instant for created data field: @Getter @Setter @AllArgsConstructor @NoArgsConstructor @EqualsAndHashCode public class Item { private String id; private String url; private Instant createdDate; } I am…
Uladzislau Kaminski
  • 2,113
  • 2
  • 14
  • 33
31
votes
2 answers

How to assign rawValue of enum to variable with ObjectMapper?

Hello I am using Object Mapper with Alamofire in Swift and I am trying to map enum raw value to real Enum. Here is my enum and also the code I am trying to use in function mapping. Can you please help me what to pass as argument to EnumTransform or…
Radim Halfar
  • 536
  • 2
  • 6
  • 15
27
votes
3 answers

Map JSON To List>

I have a JSON of the format [{ "id" : "a01", "name" : "random1", "val" : "random2" }, { "id" : "a03", "name" : "random3", "val" : "random4" }] I need to map it to a List holding various Map objects. How do I achieve…
Pranay Kumar
  • 400
  • 1
  • 3
  • 12
23
votes
7 answers

Jackson error "Illegal character... only regular white space allowed" when parsing JSON

I am trying to retrieve JSON data from a URL but get the following error: Illegal character ((CTRL-CHAR, code 31)): only regular white space (\r, \n,\t) is allowed between tokens My code: final URI uri = new URIBuilder(UrlConstants.SEARCH_URL) …
rogger2016
  • 821
  • 3
  • 11
  • 28
19
votes
3 answers

Convert Java pojo to json String

I have the following java class public class TabularDescriptor extends ReportDescriptor { private String generatorClass; private String targetClass; private String name; private String sublabel; private String reportName; …
Lilac
  • 580
  • 1
  • 7
  • 25
18
votes
2 answers

Difference between jackson objectMapper to others

I can't find any explanation about difference between jackson's ObjectMapper to other mappers like dozer/mapStruct/modelMapping/etc. All the articles compare dozer/mapStruct/modelMapping but they ignore ObjectMapper. I can't understand what is…
Plaggyy
  • 219
  • 1
  • 2
  • 8
15
votes
3 answers

Java POJO attributes mapping

I have a use case where I receive some attributes in the request like this, "filters": [ { "field": "fName", "value": "Tom" }, { "field": "LName", "value": "Hanks" } ] I don't have a model defined for this. I just receive…
User0911
  • 1,552
  • 5
  • 22
  • 33
15
votes
1 answer

Does AlamofireObjectMapper / ObjectMapper support struct type mapping

I am using AlamofireObjectMapper to parse json response to my object. The AlamofireObjectMapper is a extension of ObjectMapper. According to their documents, my model class has to conform to Mappable protocol. For example: class Forecast: Mappable…
Leem.fin
  • 40,781
  • 83
  • 202
  • 354
14
votes
2 answers

What is Podfile.lock in our Xcode projects and why is it used?

I am a beginner in using pods in Xcode projects. I have been confused by Podfile.lock. I want to update a framework "OBJECTMAPPER" to 2.0 to make it compatible with Swift 3. However it doesn't. Why doesn't it update to the latest version (2.0)?…
Jeesson_7
  • 761
  • 1
  • 11
  • 38
13
votes
2 answers

ObjectMapper enable method is deprecated

I'm upgrading the version of my project and I am currently using jackson-databind-2.13.0 .But I noticed that ObjectMapper's enable method is deprecated. They said to use it like this instead. @deprecated Since 2.13 use {@code…
Sezer Aydın
  • 187
  • 1
  • 2
  • 10
12
votes
1 answer

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.ArrayList` out of START_OBJECT token

How to read below JSON using Jackson ObjectMapper? I have developed code but getting below error. com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.ArrayList` out of START_OBJECT token at…
PAA
  • 1
  • 46
  • 174
  • 282
12
votes
1 answer

Jackson - Iterate array and manipulate its value

I have this json file: { "gateway_name": "gateway1", "fields": [ {"name":"Code", "value":""}, {"name":"PaymentId", "value":""}, {"name":"RefNo", "value":""} ] } I trying to parse this file with Jackson object mapper and iterate…
hades
  • 4,294
  • 9
  • 46
  • 71
12
votes
4 answers

AWS DynamoDB: Could not unconvert attribute error

I have an issuse and I can't handle it. I've created CRUD methods for example in KitchenService. I have methods like addProduct etc and these works fine.. But I have Recipe class where I'm using Product class field.. In this case I have huge…
D.Zet
  • 753
  • 3
  • 11
  • 32
12
votes
3 answers

Enum element cannot be referenced as an instance member

I'm creating an API layer using Moya and keep getting the above mentioned error for the .updateMyWeightGoal target when I'm creating a request for an endpoint. goalAPI.request(target: .updateMyWeightGoal(weightGoalData: goalInfo), success: {…
Suman Roy
  • 673
  • 5
  • 18
12
votes
6 answers

How can I do array mapping with objectmapper?

I have a response model that looks like this: class ResponseModel: Mappable { var data: T? var code: Int = 0 required init?(map: Map) {} func mapping(map: Map) { data <- map["data"] code <- map["code"] } } If…
frontier
  • 123
  • 1
  • 1
  • 6
1
2 3
76 77