Just pass any data to it, it will format JSON for you.
install
$ npm install formatter-json
Usage
const fj = ;const testObj =msg: ''success: truedeepData:author: 'Chvin'github: 'https://github.com/chvin'address: 'China'age: 0favorite:'run' 'movie' 'coding' eat: 'rice'someReg: /hello world/gsomeDate:someNull: nullsomeUndefined: undefinedsomeSymbol: Symbol;const strTestObj = JSON;console;console;
You will get the same result.
Set indentation
const fj = ;const strTestObj = JSON; // default 2
You will get:
Any type of result
const fj = ;console; // '1'console; // 'null'console; // undefinedconsole; // '"abc"'console; // '{}'console; // '2017-09-12T09:09:49.460Z'console; // undefinedconsole;/*`{"a": "a","b": "b"}`*/console;/*`[1,2,3]`*/