Hi everyone, i have a problem, i am using code fro...
# server
б
Hi everyone, i have a problem, i am using code from sources but Ktor returns me not json of data class but just "null" any suggestions ? THX) http://prntscr.com/mobkfz
b
Are you sending
Accept: application/json
in your request to the server?
Right now, the only supported ContentNegotiation strategy when sending, is the client’s Accept header.
https://ktor.io/servers/features/content-negotiation.html
б
yep here is a rest-client i'm using
if i put map there will be no problem, it will be serialized to json but if data class i still get null
b
You’re registering multiple handlers for gson. The
gson
builder is already registering a
GsonConverter
to
ContentType.Application.Json
, but you’re also registering a different converter via
register(Json, GsonConverter())
.
б
the same error ( everytime it's just return null except data class
also if i replace to User().toString() it will return toString somth wrong with gson conversion
may be for future i have found a solution, i just replaced gson to jackson and everything started. But for gson still no answer why it is so
b
I personally haven’t used gson to suggest anything in addition 😕
б
nevertheless thx )
s
I had the same problem with Gson and a Json file that contain an array of Objects... in the end I had to create a custom serializer