Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
json-lighter
Advanced tools
A lightweight JSON syntax highlighter for the web.
npm install json-lighter
import { JsonLighter } from "json-lighter";
const lighter = new JsonLighter({
spaces: 2,
colors: {
punctuation: "gray",
string: "orange",
number: "green",
boolean: "purple",
null: "blue",
},
});
// Inject the CSS into the document
lighter.injectCSS();
// Highlight JSON
const html = lighter.highlight(`
{
"string": "value",
"number": 123.123,
"boolean": false,
"null": null
}
`);
JsonLighter(options)
Creates a new instance of JsonLighter.
spaces
(number): Number of spaces for indentation.colors
(object): Custom colors for different JSON elements
punctuation
(string): Color for punctuation charactersstring
(string): Color for string valuesnumber
(string): Color for number valuesboolean
(string): Color for boolean valuesnull
(string): Color for null valueslighter.injectCSS()
Injects the necessary CSS into the document's head. Call this once before using the highlight
method.
lighter.highlight(json)
Highlights the provided JSON string and returns HTML with syntax highlighting.
json
(string): The JSON string to highlightFAQs
A lightweight JSON syntax highlighter for the web.
We found that json-lighter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.