Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

json-pack example

node v18.11.0
version: 1.0.0
endpointsharetweet
require("tslib") const {JsonEncoder} = require('json-joy/es2020/json-pack/json/JsonEncoder'); const {JsonDecoder} = require('json-joy/es2020/json-pack/json/JsonDecoder'); const {Writer} = require('json-joy/es2020/util/buffers/Writer'); const obj = { foo: 1, bar: "hello", binary: new Uint8Array([1, 2, 3]), }; const encoder = new JsonEncoder(new Writer()); const encoded = encoder.encode(obj); const decoder = new JsonDecoder(); const decoded = decoder.read(encoded); console.log(decoded);
Loading…

no comments

    sign in to comment