rembrembdocs

Skip to main content

Bun home pagelight logodark logo

[Runtime

](../../../index.md)[Package Manager

](../../../pm/cli/install/index.md)[Bundler

](../../../bundler/index.md)[Test Runner

](../../../test/index.md)[Guides

](../../index.md)[Reference

](https://bun.com/reference)[Blog

](https://bun.com/blog)[Feedback

](../../../feedback/index.md)

To convert a Node.js Readable stream to a JSON object in Bun, you can create a new Response object with the stream as the body, then use response.json() to read the stream into a JSON object.

import { Readable } from "stream";
const stream = Readable.from([JSON.stringify({ hello: "world" })]);
const json = await new Response(stream).json();
console.log(json); // { hello: "world" }

Was this page helpful?

Suggest editsRaise issue

[

Convert a Node.js Readable to a string

Previous

](../node-readable-to-string/index.md)[

Convert a Node.js Readable to a Blob

Next

](../node-readable-to-blob/index.md)