2.0.0 • Published 2 years ago

json-column-parser v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

npm npm GitHub npm bundle size

json-column-parser

A JSON parser for several big data sources formatted columns.

This package provides the required functionality to process the type of a complex column to a convenient json representation.

Nested Hive Column Example

array<struct<student:struct<name:string,id:string,subjects:array<struct<sub_name:string,sub_id:bigint>>>,supply:struct<
amount:bigint,product:struct<product_id:string,product_name:string,template:struct<code:string,currency:string>>,color:string>>>

Quick Start

Installation

Install this component with NPM.

npm install --save json-column-parser

Implementation

import { parser, types } from "json-column-parser";

// Parse one or more columns
// The nestedColumn used is the one from the example 	above
const parsed = parser.parseColumns([
  { name: "test_column", type: nestedColumn, description: "test_description" },
]);

console.dir(parsed[0].colType);
console.dir((parsed[0].colType as types.JSONArray)[0]);

Output

[
  {
    student: { name: 'string', id: 'string', subjects: [Array] },
    supply: { amount: 'bigint', product: [Object], color: 'string' }
  }
]
{
  student: { name: 'string', id: 'string', subjects: [ [Object] ] },
  supply: {
    amount: 'bigint',
    product: {
      product_id: 'string',
      product_name: 'string',
      template: [Object]
    },
    color: 'string'
  }
}
1.0.6

2 years ago

1.0.5

2 years ago

2.0.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago