json-to-txt
Reads JSON data (Array of objects) and returns a string in a txt file format.
Last updated 7 months ago by vprince001 .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install json-to-txt 
SYNC missed versions from official npm registry.

json-to-txt

Reads JSON data (Array of objects) and returns a string in a txt file format.

Installation

npm i --save json-to-txt

Usage

json-to-txt support CommonJS.

In module system

Use filePath key to provide JSON data from file.

const jsonToTxt = require("json-to-txt");
const dataInString = jsonToTxt({ filePath: "./filePath.json" });

Use data key to provide JSON data from variable or directly.

const jsonToTxt = require("json-to-txt");
const dataInString = jsonToTxt({ data: someJSONData });

Sample input (json data) :

[
  {
    FIRST_NAME: 'Debra',
    LAST_NAME: 'Burks',
    NUMBER: '880012XXXX',
    EMAIL: 'debra.burks@yahoo.com',
    ADDRESS: '9273 Thome Ave., Orchard Park, NY - 14127'
  },
  {
    FIRST_NAME: 'Kasha',
    LAST_NAME: 'Todd',
    NUMBER: null,
    EMAIL: 'kasha.todd@yahoo.com',
    ADDRESS: '910, Vine Street, Campbell, CA - 95008'
  },
  {
    FIRST_NAME: 'Tameka',
    LAST_NAME: 'Fisher',
    NUMBER: '880111XXXX',
    EMAIL: 'tameka.fisher@yahoo.com',
    ADDRESS: '7693 Honey Creek St., Redondo Beach, CA - 90278'
  },
  {
    FIRST_NAME: 'Daryl',
    LAST_NAME: 'Spence',
    NUMBER: '990015XXXX',
    EMAIL: null,
    ADDRESS: '988 Pearl Lane!!! (Uniondale), NY - 11553'
  },
  {
    FIRST_NAME: 'Charolette',
    LAST_NAME: 'Rice',
    NUMBER: '720012XXXX',
    EMAIL: 'charolette.rice@msn.com',
    ADDRESS: '107 ~ River Dr. `Sacramento`, "CA"      95820'
  }
]

Sample output (txt data) :

FIRST_NAME     LAST_NAME        NUMBER               EMAIL                        ADDRESS
Debra          Burks            880012XXXX           debra.burks@yahoo.com        9273 Thome Ave., Orchard Park, NY - 14127
Kasha          Todd             null                 kasha.todd@yahoo.com         910, Vine Street, Campbell, CA - 95008
Tameka         Fisher           880111XXXX           tameka.fisher@yahoo.com      7693 Honey Creek St., Redondo Beach, CA - 90278
Daryl          Spence           990015XXXX           null                         988 Pearl Lane!!! (Uniondale), NY - 11553
Charolette     Rice             720012XXXX           charolette.rice@msn.com      107 ~ River Dr. `Sacramento`, "CA"      95820

Current Tags

  • 2.0.0                                ...           latest (7 months ago)

4 Versions

  • 2.0.0                                ...           7 months ago
  • 1.0.2                                ...           7 months ago
  • 1.0.1                                ...           10 months ago
  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 6
Dependencies (2)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |