chuyik / json-table-converter

Convert any json to table.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSON To Table

A JavaScript library to convert JSON data to Table.

Feature

  • Convert JSON To <table />

Usage

npm install json-table-converter

API

jsonToTableHtmlString(json, options)

Convert Json to <table />

Param Type Description
json Object | Array
options Object
[options.tableStyle] String <table/> Style
[options.trStyle] String <tr/> Style
[options.thStyle] String <th/> Style
[options.tdStyle] String <td/> Style
[options.tdKeyStyle] String <td/> Key Style
[options.formatCell] Function Cell Value Format Function

API Flow Example

flow

Demo

const { jsonToTableHtmlString } = require('json-table-converter')
const html = jsonToTableHtmlString(json, {
  tableStyle: string, // <table/> Style
  trStyle: string,    // <tr/> Style
  thStyle: string,    // <th/> Style
  tdStyle: string,    // <td/> Style
  tdKeyStyle: string, // <td/> Key Style
  formatCell: (cellValue, isKeyCell) => newCellValue,
})

Donation

If you find this project useful, you can buy us a cup of coffee:


Contributors

chuyik
chuyik

About

Convert any json to table.


Languages

Language:JavaScript 100.0%