Skip to content
Advertisement

Tag: json

Parse datetime with offset string to LocalDateTime

I am trying to parse following datetime String to LocalDateTimeObject, however I am not able to identify the format of the datetime string. Sat, 09 Oct 2021 02:10:23 -0400 How should I determine the pattern of the above string? Answer You should first check if the date string matches any of the Predefined Formatters. If not, then you have to

Different @JsonProperty config for READ and WRITE on same field?

I have a class (which cannot be modified) like When deserializing I get data like: As I cannot modify the Standing class I have a mix-in like: As the received json does not have positionNumber and positionText fields I use the @JsonPropery annotations. With Access.READ_ONLY I simply ignore the positionNumber field. And with @JsonProperty(value = “position”, access = JsonProperty.Access.WRITE_ONLY) on

IllegalArgumentException: Unable to create @Body converter for class

Whenever I try to create a request with Retrofit it fails. The strange thing is that it worked before, I didn’t change anything about the code. Now months later it doesn’t work anymore. I’m getting the following error: IllegalArgumentException: Unable to create @Body converter for class apis.Config (parameter #2) I tried changing from Gson to Moshi but it didn’t solve

Parse a json list into list of object Java

I have a response as follows I want to map this json to a POJO object and have created this class I am currently using this way to read this The size of events is 2 but each event is coming as null instead of a map. Can Someone please help me ? Answer To achieve your goal you have

Swap Jackson custom serializer / deserializer during runtime

I have the following system: I am sending MediaType.APPLICATION_JSON_VALUEs from spring controllers to my client and vice versa. I also have an export/import feature of my to-be-serialized classes. The JSON File is created by using an ObjectMapper and utilizing the writeValueAsString and readValue methods. I am reading from and writing into the json file. Both of those serialization paths currently

Advertisement