private Flux<Object> decodeInternal(
      JsonObjectDecoder objectDecoder,
      Publisher<DataBuffer> inputStream,
      ResolvableType elementType,
      MimeType mimeType,
      Object[] hints) {

    Assert.notNull(inputStream, "'inputStream' must not be null");
    Assert.notNull(elementType, "'elementType' must not be null");

    TypeFactory typeFactory = this.mapper.getTypeFactory();
    JavaType javaType = typeFactory.constructType(elementType.getType());

    ObjectReader reader = this.mapper.readerFor(javaType);

    return objectDecoder
        .decode(inputStream, elementType, mimeType, hints)
        .map(
            dataBuffer -> {
              try {
                Object value = reader.readValue(dataBuffer.asInputStream());
                DataBufferUtils.release(dataBuffer);
                return value;
              } catch (IOException e) {
                return Flux.error(new CodecException("Error while reading the data", e));
              }
            });
  }
 @Test
 public void decodeMultipleChunksToArray() throws InterruptedException {
   JsonObjectDecoder decoder = new JsonObjectDecoder(true);
   Stream<ByteBuffer> source =
       Streams.just(
           Buffer.wrap("[{\"foo\": \"foofoo\", \"bar\"").byteBuffer(),
           Buffer.wrap(": \"barbar\"},{\"foo\": \"foofoofoo\", \"bar\": \"barbarbar\"}]")
               .byteBuffer());
   List<String> results =
       Streams.wrap(decoder.decode(source, null, null))
           .map(
               chunk -> {
                 byte[] b = new byte[chunk.remaining()];
                 chunk.get(b);
                 return new String(b, StandardCharsets.UTF_8);
               })
           .toList()
           .await();
   assertEquals(2, results.size());
   assertEquals("{\"foo\": \"foofoo\", \"bar\": \"barbar\"}", results.get(0));
   assertEquals("{\"foo\": \"foofoofoo\", \"bar\": \"barbarbar\"}", results.get(1));
 }