npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tinyjson

v0.0.3

Published

Tiny json format for avoiding keys repeation

Downloads

8

Readme

tinyjson

Tiny JavaScript Object Notation

A format based on json to reduce the size of json object by getting rid of repeated keynames into a schema object

Install via npm

npm install tinyjson --save

Import

var tinyjson = require('tinyjson');

Usage

var encodedJSON = tinyjson.encode(jsonObject);

var decodedJSON = tinyjson.decode(tinyjsonObject);

A json file with 5000 array of data size comparision

Orignal file size : 2.8MB 

Encoded file size : 1.9MB `

Size gain percentage : 32.9%

The gain percentage can reach upto 75% depending on your repeated key data.

Sample

{
  "schema": [
    "_id",
    "index",
    "guid",
    "isActive",
    "balance",
    "picture",
    "age",
    "eyeColor",
    "name",
    "gender",
    "company",
    "email",
    "phone",
    "address",
    "registered",
    "latitude",
    "longitude",
    "greeting",
    "favoriteFruit"
  ],
  "data": [
    [
      "59a9c5e9c5104e592ba5eec1",
      0,
      "8549d313-5e0d-4ae7-895e-45c61b8086bd",
      false,
      "$3,694.78",
      "http://placehold.it/32x32",
      36,
      "green",
      "Christi Huff",
      "female",
      "MANTRO",
      "[email protected]",
      "+1 (987) 413-2036",
      "650 McKibben Street, Marenisco, California, 4228",
      "2017-08-04T02:37:42 -06:-30",
      -67.501859,
      -156.9881,
      "Hello, Christi Huff! You have 4 unread messages.",
      "apple"
    ],
    ... 4999 more
  ]
},

Orignal json format

[
  {
    "_id": "59a998587ce6b3baa3bb4659",
    "index": 0,
    "guid": "b8c91fcb-a950-4173-8e4d-761fba77ab77",
    "isActive": false,
    "balance": "$1,673.28",
    "picture": "http://placehold.it/32x32",
    "age": 31,
    "eyeColor": "blue",
    "name": "Delgado Callahan",
    "gender": "male",
    "company": "SYBIXTEX",
    "email": "[email protected]",
    "phone": "+1 (870) 487-2839",
    "address": "571 Columbia Place, Camas, Utah, 5713",
    "about": "Elit laborum ex ullamco tempor consequat est elit. Aliqua sint enim eiusmod irure enim esse esse ipsum excepteur aute id ut. Cillum amet occaecat anim cupidatat est velit.\r\n",
    "registered": "2017-08-03T12:18:31 -06:-30",
    "latitude": -77.004553,
    "longitude": 93.476534,
    "greeting": "Hello, Delgado Callahan! You have 4 unread messages.",
    "favoriteFruit": "banana"
  },
  {
    "_id": "59a998582952ea956ac7574c",
    "index": 1,
    "guid": "d98970d7-08c1-467a-bfb8-97f1949e6dab",
    "isActive": true,
    "balance": "$3,030.96",
    "picture": "http://placehold.it/32x32",
    "age": 23,
    "eyeColor": "blue",
    "name": "Henderson Davidson",
    "gender": "male",
    "company": "HANDSHAKE",
    "email": "[email protected]",
    "phone": "+1 (974) 508-2717",
    "address": "185 Front Street, Newkirk, Arizona, 1667",
    "about": "Aliqua ut occaecat voluptate velit adipisicing commodo ex velit nisi quis deserunt. Ex aliquip pariatur esse laboris excepteur. Ipsum nulla anim nisi non laborum tempor. Ipsum consequat esse officia incididunt enim est adipisicing velit irure pariatur nisi consequat in.\r\n",
    "registered": "2015-04-25T08:02:35 -06:-30",
    "latitude": 56.916396,
    "longitude": -140.692789,
    "greeting": "Hello, Henderson Davidson! You have 1 unread messages.",
    "favoriteFruit": "banana"
  },
  ... 4998 more
]