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). TheintoArray() 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
- During streaming: Partial updates are deserialized as objects for real-time validation and deduplication
- After streaming completes: The final result is re-extracted and returned
as an array (respecting
intoArray()) - Best of both worlds: Object validation during streaming, array convenience for the final result