Socket
Socket
Sign inDemoInstall

json-table

Package Overview
Dependencies
3
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    json-table

Json table is an easy way to preview your json data in table


Version published
Maintainers
1
Install size
140 kB
Created

Readme

Source

json table

Build Status

Json table is an easy way to preview your json data in table

Install

Install via npm

npm install json-table

Include

var json_tb = require('json-table');

Usage

var json_tb_out = new json_tb('sample.json', {
  chars: { 'top': '═' , 'top-mid': '╤' , 'top-left': '╔' , 'top-right': '╗'
    , 'bottom': '═' , 'bottom-mid': '╧' , 'bottom-left': '╚' , 'bottom-right': '╝'
    , 'left': '║' , 'left-mid': '╟' , 'mid': '─' , 'mid-mid': '┼'
    , 'right': '║' , 'right-mid': '╢' , 'middle': '│' }
}, function(table) {
	table.show() // **have to call show() function to print out the table**
})

or

var json_tb_out = new json_tb(<JSON object>, config, callback);
  • Arguments:
    • json file, or json object (json) : the first argument can be a json file or a json object
    • configure of the table (object) : optional see detail in https://github.com/LearnBoost/cli-table
    • callback (function) : callback function

Example

Here is a sample json

[{
    
    "Format": "0",
    "Valuie": "12345.6789",
    "B Fmt": "General",
    "VBA Fmt": "",
    "Fmt": "",
    "Macro": ""
}, {
    
    "Format": "1",
    "Valuie": "12346",
    "B Fmt": "0",
    "VBA Fmt": "12346",
    "Fmt": "0",
    "Macro": "12346"
}, {
    
    "Format": "2",
    "Valuie": "12345.68",
    "B Fmt": "0.00",
    "VBA Fmt": "12345.68",
    "Fmt": "0.00",
    "Macro": "12345.68"
}
...
...

]

will convert into table like

preview

License

MIT @chilijung

Keywords

FAQs

Last updated on 17 Feb 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc