
Research
/Security News
11 Malicious Go Packages Distribute Obfuscated Remote Payloads
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
@pinojs/json-colorizer
Advanced tools
A library to format JSON with colors for display in the console
A library for colorizing JSON strings
This package is a simple console syntax highlighter for JSON.
npm install --save @pinojs/json-colorizer
const colorize = require('@pinojs/json-colorizer')
console.log(colorize({ foo: 'bar' }))
If you pass a string to the colorize function, it will treat it as pre-serialized JSON. This can be used in order to colorize pretty-printed JSON:
const colorize = require('@pinojs/json-colorizer')
const json = JSON.stringify({ foo: 'bar' }, null, 2)
console.log(colorize(json))
To pretty-print the resulting JSON, pass the pretty: true
option to the options object:
const colorize = require('@pinojs/json-colorizer')
const json = '{"foo": "bar"}'
console.log(colorize(json, { pretty: true }))
You can specify a color to use for coloring individual tokens by providing a colors
object in the options object. This should map token types to the names of color functions (see the colorette styles reference).
A color can also be specified as a hex value starting with the #
symbol.
const colorize = require('@pinojs/json-colorizer')
console.log(
colorize(
{ foo: 'bar' },
{
colors: {
STRING_KEY: 'green',
STRING_LITERAL: 'magentaBright',
NUMBER_LITERAL: 'blue'
}
}
)
)
The tokens available are:
BRACE
BRACKET
COLON
COMMA
STRING_KEY
STRING_LITERAL
NUMBER_LITERAL
BOOLEAN_LITERAL
NULL_LITERAL
FAQs
A library to format JSON with colors for display in the console
We found that @pinojs/json-colorizer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).