import { toJson } from "https://deno.land/std@0.219.1/streams/mod.ts";
Converts a JSON-formatted ReadableSteam
of strings or
Uint8Array
s to an object. Works the same as
Response.json
.
Examples
Example 1
Example 1
import { toJson } from "https://deno.land/std@0.219.1/streams/to_json.ts";
const stream = ReadableStream.from([JSON.stringify({ hello: "world" })]);
await toJson(stream); // { hello: "world" }
Parameters
readableStream: ReadableStream