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

SwiftUI view not being refreshed when Published object changes

In my view model I have this property and method: @Published var cats: [Cat] = [] //this gets populated later When I update one of the cats as such: func updateCatQuantity(_ cat:Cat, qty: Int) { if let index = cats(of: cat) { …
soleil
  • 12,133
  • 33
  • 112
  • 183
2
votes
1 answer

Conversion of JSON to Object

I am working on a Microservices Project in Java, using Spring Boot and Eureka. I came across a scenario where I fetch the data from another microservice using- List ratings=(List)…
ayush
  • 464
  • 5
  • 17
2
votes
4 answers

How to add new ObjectMapper in Spring Boot project

In my Spring Boot project I use a default Jackson ObjectMapper. I'd like to add new ObjectMapper to the Spring Context and start using it at new places, but also keep the default one. Adding new @Bean definition will override the default…
Michal Krasny
  • 5,434
  • 7
  • 36
  • 64
2
votes
1 answer

ObjectMapper not printing correct json in file

ArrayList res = manager.getRes(); objectMapper.configure(SerializationFeature.INDENT_OUTPUT, true); objectMapper.writeValue(new File(args[1]), res); I expect my outputFile to look EXACTLY like this: [ { "key1": "value", …
2
votes
0 answers

Security tool unsafe deserialization

Coverity shows the block of code with unsafe deserialization. Here the body that i am receiving is internal api call which it treats as external. but i am not sure how to get the fix. is there a way we can validate here so that it is acceptable. i…
2
votes
1 answer

Jackson parse Double from String/Pure Number Format

I have a filed, lets say something like this, which is double value boxed to native type or in string. { "field1" : 123.00 } or {"field1" : "123.00" } and Corresponding Pojo: class Response{ Double field1; } Now, if its in String…
Deekshith Anand
  • 2,175
  • 1
  • 21
  • 24
2
votes
1 answer

polymorphism fails in ternary but passes in standard conditional (capture of ?)

I have an interface called Employee and two implementing classes FullTimeEmployee and PartTimeEmployee. In a seperate class, I am attempting to use ObjectMapper to assign the correct class. The method looks as follows public Employee…
tbatch
  • 1,398
  • 10
  • 21
2
votes
1 answer

Mapstruct convert field to object field

I want to map two object with mapStruct public class EntityA { @Id private String id; @Column private String anotherField The second object with an object a paramter public class ABC { private final ObjectXYZ identification; //…
emoleumassi
  • 4,881
  • 13
  • 67
  • 93
2
votes
1 answer

Is there a way to pass ObjectMapper's JsonNode Object to selenium's sendKeys method?

I want to read a JSON file and pass its content to a browser page using selenium-java. Using ObjectMapper, I am able to read the file OK. ObjectMapper mapper = new ObjectMapper(); JsonNode payload = mapper.readTree(new…
matt
  • 25
  • 5
2
votes
3 answers

Jackson polymorphic serialization: how to remove super type property wrapper?

I have this situation: @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT) @JsonSubTypes({ @JsonSubTypes.Type(value = FlyingCar.class, name = "flying_car"), @JsonSubTypes.Type(value =…
akuma8
  • 4,160
  • 5
  • 46
  • 82
2
votes
1 answer

com.fasterxml.jackson.databind.JsonMappingException: Cannot invoke "java.lang.Boolean.booleanValue()" because "this.flag" is null

I'm trying to use Jackson in case to serialize and then deserialize an object. The object contains a field -> protected Serializable data This is where the problem comes from - this data can come from a lot of components. That is why I'm trying to…
2
votes
0 answers

jackson objectmapper does not use custom [de]serializer when calling writeValueAsString

My overall goal is to have "null" lists deserialized and serialized as empty lists. So creating a class with the variable List foo with a null value, will finally be set as the empty list. The same when writing the object as json. If List foo is…
sveri
  • 1,372
  • 1
  • 13
  • 28
2
votes
1 answer

How to override custom Jackson deserializer in child project?

In our company library (say lib-a) we have an interface: public interface MyInterface { ... } and its default implementation: public enum DefaultMyImpl implements MyInterface { ... } a serializer for it: public class…
Hasan Can Saral
  • 2,950
  • 5
  • 43
  • 78
2
votes
1 answer

Applying custom runtime logic to JSON serialization in SpringBoot @RestController response

We are building an app that may produce hundreds of unique JSON payload structures from our streamlined object model and we want to avoid adding hundreds of POJOs to our Java codebase (1 per unique payload structure). We built a way to build, parse…
2
votes
0 answers

How to create Single Line Yaml Array using Jackson in Java

I want to create a yaml file as follows: hello: World value: 3 lists:['T1','T2'] I came up with below code: public static void main(String[] args) throws IOException { Data data = new Data(); data.setHello("World"); data.setValue(3); …
Ananya
  • 187
  • 3
  • 12