Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
function toJson
import { toJson } from "https://deno.land/x/fathym_eac_runtime@v0.0.140/src/src.deps.ts";

Converts a JSON-formatted ReadableSteam of strings or Uint8Arrays to an object. Works the same as Response.json.

Examples

Example 1

import { toJson } from "https://deno.land/std@0.224.0/streams/to_json.ts";

const stream = ReadableStream.from([JSON.stringify({ hello: "world" })]);
await toJson(stream); // { hello: "world" }

Parameters

readableStream: ReadableStream

Returns

Promise<unknown>