Anyone know of a simple jsonrpc library for Kotlin...
# server
d
Anyone know of a simple jsonrpc library for Kotlin?
c
By that do you mean a rest client? If so any of the big java ones work, or there is Fuel if you want one written in kotlin
g
No, jsonrpc is not a rest client, it's jsonrpc client 😅 Just use any Java jsonrpc which you like.
d
Kotlin is sooo much easier when it comes to json deserialization and serialization... just the reified types already make a big difference... I guess I'll have to make my own layer... Thanks anyways 🙂
g
I would choose some Java Library and add some idiomatic wrappers to improve API
d
I did, I ended up with lots of casting...
Copy code
modelsConfig.createRequest(
					"execute_kw", baseParams + listOf(
					model, "read", recIds, mapOf("fields" to fields)
			)).let { xmlRpcClient.awaitExecutes(it, Array<Any>::class.java) }
					.map { it as HashMap<String, Any> }
Which isn't too nice... I guess the jsonrpc spec is pretty simple, I think I'll try the Ktor client, and just do the json parsing w/ a seperate library...
g
Why do you parse it as Array<Any>?
d
Because I get an Object as a result... the Jackson parsing doesn't fit, since I need to translate non-standard responses... like ids being returned as a List of an Int and a String...