json-all-to-one

0.2.4 • Public • Published

JSON-all-to-one

It is a script for a few JSON files concatenation to one.

For example you have a directory with JSON files:

dir/
  file-1.json
  file-2.json

You want to concatenate all of them to one file.

Let's do it!

Install

npm i -g json-all-to-one

Params

// Types
'--source': String, // path to source filename
'--output': String, // output filename
'--name': String, // wrapper name
'--childrenOf': String, // get children of

// Aliases
'-s': '--source',
'-o': '--output',
'-n': '--name',
'-c': '--childrenOf',

Use

Example 1

json-all-to-one -s 'some-dir' -o 'all-in-one.json'

You will receive a file:

{
  "data": [
    { "object1" },
    { "object2" },
    { "etc" }
  ]
}

Example 2

json-all-to-one -s 'some-dir' -o 'all-in-one.json' -n 'xxx'

You will receive a file:

{
  "xxx": [
    { "object1" },
    { "object2" },
    { "etc" }
  ]
}

Example 3

json-all-to-one -s 'some-dir' -o 'all-in-one.json' -c 'old-data'

If you want to get objects inside parent "old-data" (some-dir/file-1)

{
  "old-data": [
    { "object1" },
    { "object2" },
    { "etc" }
  ]
}

Readme

Keywords

Package Sidebar

Install

npm i json-all-to-one

Weekly Downloads

0

Version

0.2.4

License

ISC

Unpacked Size

4.5 kB

Total Files

6

Last publish

Collaborators

  • tertiumnon