Skip to content

Latest commit

 

History

History

json

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

@urlpack/json

Package Version License Bundle Size

Compress JSON data into compact & URL-safe formats

  • ES Modules & Browser compatible
  • Compact output using MessagePack
  • URL safe formats (Base62, Base58)
  • Composable & Tree-shakable

Usage

import { makeJsonEncoder } from '@urlpack/json';

const encoder = makeJsonEncoder();

encoder.encode({
  href: 'http://daangn.com',
  uid: 1234567,
  context: {
    foo: 'bar',
    baz: [1,2,3,4,5],
  },
})
// => 'QL3sGqgSwhebCV6jsPsxSCG6DPGZUAo7qtLbEFxFN3bequ3qABcg6pxvpvr36FveMxCtD4zNSWSpHmxgz8'
//
// Only 82 characters, 35% smaller output than JSON.stringify + lz-string

LICENSE

MIT