
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
@davidfig/json-depth
Advanced tools
Prettify JSON for output with a number of options, including inlining after a set depth
Prettify JSON for output with a number of options, including inlining after a set depth
My OCD forced me to create this. I wanted to edit JSON files prettified to a certain depth and I couldn't find an appropriate npm package. I added other options as well.
npm i @davidfig/json-depth
const fs = require('fs')
const jsonDepth = require('json-depth')
const data = { vehicles: ['cars', 'trucks', 'motorcycles', 'bicycles'], colors: ['red', 'green', 'blue']}
console.log(jsonDepth(data, { depth: 1 }))
/* RESULT:
{
"vehicles": ["cars", "trucks", "motorcycles", "bicycles"],
"colors": ["red", "green", "blue"]
}
*/
fs.writeFile('test/test-output.json', jsonDepth(DATA, { depth: 2 }), () =>
{
console.log('wrote file: test-output.json')
process.exit(0)
})
// prettify JSON with more options
function jsondepth(data, options)
name | type | default | description |
---|---|---|---|
data | object | data to be prettified | |
options | object | ||
options.depth | number | 3 | the number of depths to expand with options.eol characters |
options.indent | string | /t | a string or the number of spaces to indent each depth |
options.spaces | number | 0 | number of spaces to use instead of indent character |
options.eol | string | \n | end of line character |
options.spaceAfter | number | 1 | spaces after bracket, squiggly bracket, comma, or colon |
options.ignoreNull | boolean | false | ignore null |
options.ignoreUndefined | boolean | true | ignore undefined entries |
options.emptyArray | string | [] | replace empty array with this string |
options.emptyObject | string | {} | replace empty object with this string |
options.spaceInlineArray | boolean | false | whether to add a space at the beginning and end of an inline array |
options.spaceInlineObject | boolean | true | whether to add a space at the beginning and end of an inline object |
MIT License
(c) 2018 YOPEY YOPEY LLC by David Figatner
FAQs
Prettify JSON for output with a number of options, including inlining after a set depth
We found that @davidfig/json-depth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.