JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12
  • Score
    100M100P100Q34001F
  • License MIT

Package Exports

  • json-columnar-compression
  • json-columnar-compression/dist/index.js
  • json-columnar-compression/dist/index.mjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (json-columnar-compression) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Json to Columnar Compression

  • Efficiently converts JSON to columnar format and back, enabling faster transmission and reduced storage.
  • This approach is especially beneficial when working with large datasets .
  • You can provide JSON in any structure or format.

Usage

import {CompressJsonToColumnar , DecompressColumnarToJson} from 'json-columnar-compression'




const array = [
  {
    "id": 1,
    "name": "Alice",
    "age": 28,
    "city": "New York",
    "children": [
      { "id": 11, "name": "Anna", "age": 5 },
      { "id": 12, "name": "Alex", "age": 7 }
    ]
  },
  {
    "id": 2,
    "name": "Bob",
    "age": 34,
    "city": "Los Angeles",
    "children": [{ "id": 21, "name": "Ben", "age": 8 }]
  },
  { "id": 3, "name": "Charlie", "age": 25, "city": "Chicago", "children": null }
]



const compressed = CompressJsonToColumnar(array)

// console.log(compressed)
// [
//   ["id", [1, 2, 3]],
//   ["name", ["Alice", "Bob", "Charlie"]],
//   ["age", [28, 34, 25]],
//   ["city", ["New York", "Los Angeles", "Chicago"]],
//   [
//     "children",
//     [
//       [
//         ["id", [11, 12]],
//         ["name", ["Anna", "Alex"]],
//         ["age", [5, 7]]
//       ],
//       [
//         ["id", [21]],
//         ["name", ["Ben"]],
//         ["age", [8]]
//       ],
//       null
//     ]
//   ]
// ]


const decompressed = DecompressColumnarToJson(compressed)

// console.log(decompressed)
// [
//   {
//     "id": 1,
//     "name": "Alice",
//     "age": 28,
//     "city": "New York",
//     "children": [
//       { "id": 11, "name": "Anna", "age": 5 },
//       { "id": 12, "name": "Alex", "age": 7 }
//     ]
//   },
//   {
//     "id": 2,
//     "name": "Bob",
//     "age": 34,
//     "city": "Los Angeles",
//     "children": [{ "id": 21, "name": "Ben", "age": 8 }]
//   },
//   { "id": 3, "name": "Charlie", "age": 25, "city": "Chicago", "children": null }
// ]

Or Use CDN link

  <script src="
https://cdn.jsdelivr.net/npm/json-columnar-compression@0.0.9/dist/index.min.js
"></script>