> ## Documentation Index
> Fetch the complete documentation index at: https://bun.zhcndoc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 将 Node.js Readable 转换为 JSON

要在 Bun 中将 Node.js 的 `Readable` 流转换为 JSON 对象，可以创建一个以该流作为主体的新 [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) 对象，然后使用 [`response.json()`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json) 将流读取为 JSON 对象。

```ts theme={"theme":{"light":"github-light","dark":"dracula"}}
import { Readable } from "stream";
const stream = Readable.from([JSON.stringify({ hello: "world" })]);
const json = await new Response(stream).json();
console.log(json); // { hello: "world" }
```
