Skip to content

Add kotlinx.serialization JSON support to Spring WebFlux #25771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sdeleuze opened this issue Sep 14, 2020 · 6 comments
Closed

Add kotlinx.serialization JSON support to Spring WebFlux #25771

sdeleuze opened this issue Sep 14, 2020 · 6 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@sdeleuze
Copy link
Contributor

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.

@sdeleuze sdeleuze added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement labels Sep 14, 2020
@sdeleuze sdeleuze added this to the 5.3 RC2 milestone Sep 14, 2020
@sdeleuze sdeleuze self-assigned this Sep 14, 2020
@sdeleuze
Copy link
Contributor Author

Kotlin/kotlinx.serialization#1073 should bring deserialization of big JSON arrays to Flow.

@vladimirfx
Copy link

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?

@sdeleuze
Copy link
Contributor Author

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.

@vladimirfx
Copy link

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.

@vladimirfx
Copy link

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

@sdeleuze
Copy link
Contributor Author

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants