std JSON serializer/deserializer with Set and Map support
does jsr/std have functions to serialize and deserialize sets and maps? like https://github.com/denostack/superserial but for standard library
GitHub
GitHub - denostack/superserial: A comprehensive Serializer/Deserial...
A comprehensive Serializer/Deserializer that can handle any data type. - denostack/superserial
3 Replies
They dont have functions to serialise them to json but there are other serialisers to other formats.
The @std/cbor package supports serialising maps but sets will need to be converted to an array first
You can also try
msgpack
, but I'm not sure if it supports Set and Map
There is some builtin serialization because KV supports Map and Set, but I dont think it's exposed to users: https://docs.deno.com/deploy/kv/manual/key_space/#valuesIt would be very hard to beat the performance of native V8 JSON!
Native V8 JSON is extremely fast
See this in action : https://nhrones.github.io/Hot_BuenoCache/
NOTE: First use builds a test dataset in IndexedDB. Run more than once.
Repo at: https://github.com/nhrones/Hot_BuenoCache