File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -457,6 +457,33 @@ To configure or customize the readers and writers to use applications will typic
457
457
458
458
459
459
460
+ [[webflux-codecs-jackson-json]]
461
+ ==== Jackson JSON
462
+
463
+ The decoder relies on Jackson's non-blocking, byte array parser to parse a stream of byte
464
+ chunks into a `TokenBuffer` stream, which can then be turned into Objects with Jackson's
465
+ `ObjectMapper`.
466
+
467
+ The encoder processes a `Publisher<?>` as follows:
468
+
469
+ * if the `Publisher` is a `Mono` (i.e. single value), the value is encoded to JSON.
470
+ * if media type is `application/stream+json`, each value produced by the
471
+ `Publisher` is encoded individually to JSON followed by a new line.
472
+ * otherwise all items from the `Publisher` are gathered in with `Flux#collectToList()`
473
+ and the resulting collection is encoded as a JSON array.
474
+
475
+ As a special case to the above rules the `ServerSentEventHttpMessageWriter` feeds items
476
+ emitted from its input `Publisher` individually into the `Jackson2JsonEncoder` as a
477
+ `Mono<?>`.
478
+
479
+ Note that both the Jackson JSON encoder and decoder explicitly back out of rendering
480
+ elements of type `String`. Instead ``String``'s are treated as low level content, (i.e.
481
+ serialized JSON) and are rendered as-is by the `CharSequenceEncoder`. If you want a
482
+ `Flux<String>` rendered as a JSON array, you'll have to use `Flux#collectToList()` and
483
+ provide a `Mono<List<String>>` instead.
484
+
485
+
486
+
460
487
461
488
[[webflux-dispatcher-handler]]
462
489
== DispatcherHandler
You can’t perform that action at this time.
0 commit comments