Spring-framework: Add kotlinx.serialization JSON support to Spring WebFlux

Created on 14 Sep 2020  路  6Comments  路  Source: spring-projects/spring-framework

As a follow up of #21188, we should add support for kotlinx.serialization JSON to WebFlux. This will not support Flow decoding because the library does not support yet non-blocking parsing of JSON tokens like Jackson does.

web enhancement

Most helpful comment

Kotlin full stack projects (we have one - Kofu+KotlinJS+React) can have significant benefit from this feature. We're all waiting for!

All 6 comments

https://github.com/Kotlin/kotlinx.serialization/issues/1073 should bring deserialization of big JSON arrays to Flow.

IMO non-blocking parsing is actual for streaming use cases only. But most of microservices workloads operate on memory fit (request) buffers so it can be considered as CPU only workload in parsing phase. In such case parsing can be performed as map step on fully populated buffer (ie ByteArray).
Does it make sense implement this feature for non streaming use case first and then when Kotlin/kotlinx.serialization#1073 will be resolved implement full solution?

Yes we plan to do that but I think Kotlin/kotlinx.serialization#1073 is only for big arrays so no support plain stream of multiple JSON objects.

I think Roman Elizarov mentioned arrays only as obvious example of such streaming cases. So new polymorphic parser can skip unknown types as such new pull-parsing API must support skipping too. And there is another use cases such as pre-parsing filters/transformers.

Kotlin full stack projects (we have one - Kofu+KotlinJS+React) can have significant benefit from this feature. We're all waiting for!

For streaming I don't think we so at least for now, we discussed that with Roman and I think the decision was to support only arrays for now since for most use cases the framing is already handled by the underlying protocol (SSE, RSocket).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anborg picture anborg  路  4Comments

davidjgoss picture davidjgoss  路  4Comments

sbrannen picture sbrannen  路  4Comments

alvaro-nogueira picture alvaro-nogueira  路  3Comments

AstralStorm picture AstralStorm  路  4Comments