Structured JSON
Structured JSON
Stringify and parse JavaScript values according to Structured Clone Algorithm.
Stringify and parse JavaScript values according to Structured Clone Algorithm.
This allows sending more advanced JS types across the network, including Date
, Map
, Set
, ArrayBuffer
and various typed arrays.
See https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm for more.
Usage
import * as Structured from '@worker-tools/structured-json'
The module exposes these functions:
Structured.stringify
Structured.parse
Structured.toJSON
Structured.fromJSON
This module supports File
, Blob
and FileList
, however use of stringifyAsync
or toJSONAsync
is required if your data contains any of these.
Links: GitHub | ghuc.cc · NPM | Browse Package · deno.land | Docs