Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
function JSONCodec
import { JSONCodec } from "https://deno.land/x/natsws@v1.28.0/src/mod.ts";

Returns a Codec for encoding JavaScript object to JSON and serialize them to an Uint8Array, and conversely, from an Uint8Array to JSON to a JavaScript Object.

Type Parameters

optional
T = unknown

Parameters

optional
reviver: (
this: unknown,
key: string,
value: unknown,
) => unknown