diff options
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt b/src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt index 4c6ecf82..151f84a2 100644 --- a/src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt +++ b/src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt @@ -337,11 +337,15 @@ open class RemoteAgent<out T>(val serviceManager: ServiceManager<T>) { if (serializer != null) { JSON.stringify(serializer, it) } else { - try { - @Suppress("UNCHECKED_CAST") - JSON.stringify((PAR::class as KClass<Any>).serializer(), it as Any) - } catch (e: Throwable) { - it.toString() + if (it is Enum<*>) { + "\"$it\"" + } else { + try { + @Suppress("UNCHECKED_CAST") + JSON.stringify((PAR::class as KClass<Any>).serializer(), it as Any) + } catch (e: Throwable) { + it.toString() + } } } } |