
Product
Secure Your AI-Generated Code with Socket MCP
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
json-file-plus
Advanced tools
Read from and write to a JSON file, minimizing diffs and preserving formatting.
Supply Chain Security
Vulnerability
Quality
Maintenance
License
A module to read from and write to JSON files, without losing formatting, to minimize diffs.
var jsonFile = require('json-file-plus');
var path = require('path'); // in node-core
var filename = path.join(process.cwd(), 'package.json');
jsonFile(filename, function (err, file) {
if (err) { return doSomethingWithError(err); }
file.data; // Direct access to the data from the file
file.format; // extracted formatting data. change at will.
file.get('version'); // get top-level keys, synchronously
file.get('version', callback); // get top-level keys, asynchronously
file.get(); // get entire data, synchronously
file.get(callback); // get entire data, asynchronously
/* pass any plain object into "set" to merge in a deep copy */
/* please note: references will be broken. */
/* if a non-plain object is passed, will throw a TypeError. */
file.set({
foo: 'bar',
bar: {
baz: true
}
});
/* change the filename if desired */
file.filename = path.join(process.cwd(), 'new-package.json');
/* Save the file, preserving formatting. */
/* Callback will be passed to fs.writeFile */
file.save(fsWriteFileCallback);
});
Simply run npm test
in the repo
FAQs
[![github actions][actions-image]][actions-url] [![coverage][codecov-image]][codecov-url] [![dependency status][deps-svg]][deps-url] [![dev dependency status][dev-deps-svg]][dev-deps-url] [![License][license-image]][license-url] [![Downloads][downloads-im
The npm package json-file-plus receives a total of 93,601 weekly downloads. As such, json-file-plus popularity was classified as popular.
We found that json-file-plus demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Product
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.