SSE to JSON

SSE Stream
Blank line separates events0 lines0 chars
JSON Array0

Formatted JSON shows up here

Paste id/event/data blocks separated by blank lines on the left, and each event becomes one item of the JSON array.

0 eventsWaiting for input

A focused converter for Server-Sent Events (SSE) push data. Paste raw id/event/data blocks on the left, and the right side instantly renders a standard JSON array where each pushed event becomes a single object with its id, event name, and parsed data payload.

Related

What is SSE to JSON conversion?

Server-Sent Events (SSE) is a unidirectional streaming protocol where a server writes UTF-8 text events over an HTTP response of type `text/event-stream`. On the wire, every event is a sequence of field lines such as `id: 1`, `event: MESSAGE`, and `data: {...}`, and a blank line marks the end of that event.

Raw SSE is convenient for transport but awkward to read and debug. Field names repeat on every event, the JSON payload sits behind a `data:` prefix, and long streams collapse into a wall of text. Converting SSE to JSON means normalizing each event into a plain object and collecting all events into one JSON array.

This converter follows the event-stream interpretation rules: it splits on line endings, treats a blank line as the dispatch boundary, removes exactly one optional space after the field colon, joins repeated data lines with newlines, and ignores colon-prefixed comments. It then parses each data payload as JSON so nested structures are preserved.

The result is a standard, indented JSON array that is easy to read, copy into code, diff against another capture, or feed into downstream tooling, while any unparsable payload is flagged rather than dropped.

Use Cases

  • Debug LLM or AI agent streaming responses that arrive as SSE event chunks such as STREAM_CHUNK or CHUNK_DELTA
  • Turn a copied text/event-stream response from browser DevTools Network tab into readable JSON
  • Inspect heartbeat, ack, and full-message events from a real-time push or chat backend
  • Convert captured SSE push data into a JSON array before sharing it with a teammate for debugging
  • Extract and expand the nested data payload of every event without manually removing data: prefixes
  • Replay a recorded push stream offline and compare event ordering by id
  • Prepare SSE event data for analytics, logs, or spreadsheets that expect a JSON array
  • Verify that a server emits the expected event names and payload shape during frontend-backend integration
  • Flatten multi-line data fields into a single parsed value per event object
  • Inspect SSE traces from proxies, gateways, or curl output in a structured, collapsible-friendly form
  • Convert Webhook-style or message-queue event streams that reuse the SSE wire format into JSON
  • Learn the Server-Sent Events wire format by seeing how id, event, and data map to JSON objects

How to Use

  1. Paste the raw SSE stream into the left textarea, with id/event/data lines and a blank line between events
  2. The right side updates automatically and shows a JSON array with one object per event
  3. Check the warning panel if a data payload is not valid JSON or a field looks malformed
  4. Use Copy to copy the whole JSON array, or Sample to load a built-in example first

Features

  • Converts a raw SSE event stream into a standard JSON array, with one object per pushed event
  • Groups lines into events by blank line, following the Server-Sent Events dispatch model
  • Parses each field as field: value and strips the single space after the colon
  • Parses every data payload with JSON.parse so nested payloads become real objects, not escaped strings
  • Keeps a stable key order of id, event, data, and turns numeric ids into JSON numbers
  • Supports multi-line data fields, comment lines that start with a colon, and streams without a trailing blank line
  • Reports invalid data payloads and unknown or malformed fields with block and line numbers
  • Split textarea input and JSON preview layout, with sample, clear, copy, and event statistics; runs entirely in the browser

SSE to JSON vs JSONL formatter vs JSON formatter

These tools handle different input shapes. Choosing the right one avoids manually stripping prefixes and wrapping arrays.

ToolInput shapeMain strengthWhen to use it
SSE to JSONid/event/data blocks split by blank linesUnderstands SSE fields and parses each data payloadServer push streams, text/event-stream, AI streaming chunks
JSONL FormatterOne complete JSON object per lineValidates and formats each line independentlyNDJSON logs, archived events, line-delimited exports
JSON FormatterOne complete JSON object or arrayBeautifies a single full JSON documentAPI responses, config files, one-shot payloads

Best Practices

Keep the blank line between events when copying a stream

The blank line is what separates one SSE event from the next. If you remove blank lines while copying, distinct events can merge into one block and the conversion will no longer match the original dispatch order.

Use the block and line numbers in warnings to jump to the problem

When a data payload fails to parse, the warning names the event block and the offending line. Compare that block with a nearby valid event to spot a truncated brace, a missing quote, or joined chunks.

Remember only the data field is parsed as JSON

The id, event, and retry fields are SSE transport metadata and stay as scalar values. Do not expect the converter to parse JSON that appears inside the event name or id; structured content belongs in data.

Assemble partial streaming chunks before converting a full message

Many AI streams send many small STREAM_CHUNK events that build one message. Convert the whole capture first to see every chunk as an array item, then merge chunk payloads in your application code if you need the final message.

Sanitize sensitive payloads before sharing the converted JSON

Conversion is local, but once you copy the JSON array into a ticket or chat it leaves your machine. Remove tokens, user ids, and private conversation text from the output before sharing.

FAQ

What is SSE (Server-Sent Events)?

SSE is a standard way for a server to push text events to a browser over HTTP using the `text/event-stream` content type. Each event is made of text lines such as `id`, `event`, and `data`, and events are separated from each other by a blank line.

How does this tool split the stream into events?

It follows the SSE dispatch model: the input is split into lines, consecutive non-empty lines form one event block, and a blank line dispatches that block as a new event. A final block without a trailing blank line is still emitted, and comment lines that start with a colon are ignored.

What does the output JSON look like?

The result is one JSON array. Each input event becomes one object with the fields that were present, in the stable order id, event, data. The `data` text is parsed with JSON.parse, so a payload like `data: {"a":1}` becomes a nested object `"data": {"a":1}` instead of an escaped string.

Why is the id a number in the output?

SSE ids are technically strings, but real push streams almost always use numeric ids such as `id: 0`. When an id consists only of digits, the converter emits it as a JSON number; any other id is kept as a string.

What happens when data spans multiple lines?

Per the SSE specification, multiple `data:` lines inside one event are joined with a newline character before being parsed as one value. If the joined text is not valid JSON, the converter keeps the raw text and adds a warning so nothing is silently lost.

What if a data payload is not valid JSON?

Instead of failing the whole conversion, that event keeps the raw data as a JSON string and the page shows a warning with the block number and the parser error message. Valid events around it are still converted normally.

What is the difference between SSE to JSON and JSONL formatter?

JSONL has one complete JSON object on every line. SSE instead has labeled `id/event/data` lines grouped into events by blank lines, and only the data portion is JSON. SSE to JSON understands those field labels and the blank-line event boundaries, while a JSONL formatter would treat every line independently.

Does this converter upload my stream data?

No. Parsing and formatting run entirely in your browser, so push data, tokens, and conversation contents never leave your machine.

Glossary

SSE
Server-Sent Events, a standard for one-way server-to-client push streaming over HTTP.
text/event-stream
The MIME media type of an SSE response body, which contains field lines separated by blank lines.
Event block
A group of consecutive non-empty field lines that together describe one pushed event, terminated by a blank line.
data field
The SSE field carrying the event payload; multiple data lines in one event are joined with a newline and are typically JSON.
event field
The optional field that names the event type; when absent the browser dispatches it as the generic 'message' event.
id field
The optional last-event-id value used for resuming a stream; this converter emits numeric ids as JSON numbers.
retry field
An optional field telling the client the reconnection wait in milliseconds; it must contain only ASCII digits.
Comment line
A line starting with a colon, often used as a heartbeat or keep-alive, which is ignored when building events.

Authoritative References