(although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('{"owner":"Joe Bloggs","site":"House","timestampRange":{"endDay":3,"endHour":12,"endMinute":0,"endMonth":5,"endYear":2019,"startDay":2,"startHour":12,"startMinute":0,"startMonth":5,"startYear":2019}}'
Upon inspection the JSON structure matches correctly to the data classes yet deserialization fails when the Android client makes a HTTP request. The CLI client works fine without any issues. Is there a way to fix the JSON deserialization issue? Is the issue related to this GitHub issue ( https://github.com/FasterXML/jackson-module-kotlin/issues/91 )?
napperley
05/02/2019, 6:57 AM
SensorDataTimestampRangeBody model:
Copy code
data class SensorDataTimestampRangeBody(val owner: String, val site: String, val timestampRange: TimestampRange)
napperley
05/02/2019, 6:58 AM
TimestampRange model:
Copy code
data class TimestampRange(
val startYear: Int,
val startMonth: Int,
val startDay: Int,
val endYear: Int,
val endMonth: Int,
val endDay: Int,
val startHour: Int,
val startMinute: Int,
val endHour: Int,
val endMinute: Int
)
m
mp
05/03/2019, 1:22 PM
Jackson is complaining that you’re trying to deserialize from a String.
mp
05/03/2019, 1:23 PM
The json structure is probably fine but it’s inside a String — see the quotes in the error message around the curlies
mp
05/03/2019, 1:23 PM
Perhaps content type is not set on the Android client?
n
napperley
05/03/2019, 10:55 PM
Discovered with the Android client that it is producing a String instead of a Object. I have rectified the issue and have had no issues since 😄.