json-object-concat

1.0.6 • Public • Published

Json-Object-Concat

npm version

Takes a json object, and concats that to another object in a json file.

What is it?

When you have a file named Data.json, and you want to concat a json object to that, you would only be able to do that in a stupidly hard way. This npm package gets rid of that for you.

Data.json:

{
  "User":{
    "name": "Ben Bieler",
    "created": "1463381481324",
    "description": "Lorem ipsum dolor sit amet",
    "sha": "20a3s8945203kh"
  },
}

Now concatenating another "User" on to the already existing one is a hassle.

Getting started:

npm install --save json-object-concat

Usage:

Es6 / Es2015:
import jsObjConcat from 'json-object-concat';

let data = {
  "User":{
        "name": "John Doe",
        "created": "1463382129211",
        "description": "Lorem ipsum dolor sit amet",
        "sha": "20gd33s8945203kh"
  },
};
jsObjConcat(__dirname + './data/Data.json', data);
Es5:
var jsObjConcat = require 'json-object-concat';

var data = {
  "User":{
        "name": "John Doe",
        "created": "1463382129211",
        "description": "Lorem ipsum dolor sit amet",
        "sha": "20gd33s8945203kh"
  },
};
jsObjConcat( __dirname + './data/Data.json', data);

License

The MIT License (MIT)

Copyright (c) <2016> Benjamin Bieler benjaminbieler2014@gmail.com (https://twitter.com/BenBieler)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Package Sidebar

Install

npm i json-object-concat

Weekly Downloads

2

Version

1.0.6

License

MIT

Last publish

Collaborators

  • benbieler