Skip to content

a Blazing fast json serialization and deserialization. Bigint,Date,Function,REgexp,Map and more.

License

Notifications You must be signed in to change notification settings

pouchlabs/pjson

Repository files navigation

Pjson

a Blazing fast json serialization and deserialization. Bigint,Date,Function,REgexp,Map and more.

Key features

  • fast serialization and deserialization.
  • lightweight - super small less than 5kb.
  • Type safety with autocompletion
  • multi-runtime - runs everywhere js runs.
  • Framework agnostic
npm  install @pouchlab/json

supported data types

  • Map
  • Set
  • URL
  • Strings
  • Functions
  • Regexp
  • Date
  • Bigint
  • list
  • object
  • undefined
  • null

usage

import Json from "@pouchlab/json" //or import {Json} from "@pouchlab/json"


let m = new Set()
let ob = {
  test:"hi"
}
//map
let map = new Map().set("ob",ob)

let rgx = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/

m.add([()=>{}])
m.add(["kkk",{ab:2,fn:async ()=>{},r: new Date(),x: rgx}])
console.log(Json.parse(Json.stringify({s:m,map,["aj",null,undefined],fn:async ()=>{},b:BigInt(5)})))

Benchmark

benchmark through tinybench bench

support

support the development of this project,financial and code contribution are welcomed. Made with love by Pouchlabs & core-team.

About

a Blazing fast json serialization and deserialization. Bigint,Date,Function,REgexp,Map and more.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published