Skip to main content

Overview

When streaming responses, you often want real-time updates as objects (for validation and deduplication), but the final result as an array (for database storage or API responses). The intoArray() method works seamlessly with streaming - partial updates are objects during streaming, but the final value is returned as an array.

Example

Expected Output

How It Works

  1. During streaming: Partial updates are deserialized as objects for real-time validation and deduplication
  2. After streaming completes: The final result is re-extracted and returned as an array (respecting intoArray())
  3. Best of both worlds: Object validation during streaming, array convenience for the final result