

Native JSONL support in your SDKs
New features to the Speakeasy Platform - April 7, 2025
Structured Streaming APIs powered by formats like JSON Lines (JSONL) are revolutionizing how applications consume real-time data. Their surging popularity isn’t surprising—they enable everything from token-by-token LLM interactions to large-scale analytics with minimal latency, fundamentally changing how AI systems process information. Today, we’re excited to announce built-in support for JSONL in Speakeasy-generated SDKs—eliminating complex boilerplate code and improving developer experience. This capability also complements our existing support for the Server-Sent Events (SSE) streaming protocol.
How it works
When you define an API operation response using the application/jsonl
content type and specify the schema for the individual line objects within your OpenAPI document, Speakeasy automatically generates SDK code to handle the entire consumption workflow. This built-in logic manages asynchronous HTTP handling, response buffering, line-by-line JSON parsing, schema validation per object, error handling, and deserialization into type-safe data models (like Pydantic models in Python). While JSONL itself is a data format, this generated code simplifies the process of consuming streams delivering data in that format. JSONL support is now available for Python SDK generation, and we are actively developing support for TypeScript, Go, Java, C#, PHP, Ruby and all future languages.
Use Cases
This feature provides a superior developer experience for consumers of your streaming APIs in scenarios like:
- Consuming token-by-token responses from AI/LLM services.
- Building reactive AI agents that analyze structured data mid-stream.
- Processing large dataset exports efficiently line-by-line.
- Ingesting real-time application logs or event streams.
Getting Started
Enabling effortless JSONL consumption for your users is straightforward:
- Define the stream endpoint in your OpenAPI Specification: Ensure your response definition uses
content: application/jsonl:
and includes a validschema:
describing the objects in each line.# Example OpenAPI definition snippet/stream:get:responses:'200':content:application/jsonl:schema:# Your per-line object schema heretype: objectproperties:id:type: integermessage:type: string - Generate your SDK: Use the Speakeasy CLI. If regenerating an existing project or starting fresh,
quickstart
can often be used.speakeasy quickstart - Empower your users: Inform your Python SDK consumers that they can now use the generated methods to easily iterate over validated, typed objects from the JSONL-formatted stream, eliminating manual parsing and handling.