
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
json-fusion
Advanced tools
Json-Fusion is a Node.js library designed to streamline the process of loading, merging, and reflecting directory hierarchies in JSON files. With Json-Fusion, you can consolidate information scattered across different JSON files, and reflect your filesyst
json-fusion
is a Node.js library designed to streamline the process of loading, merging, and reflecting directory hierarchies in JSON files. With json-fusion
, you can consolidate information scattered across different JSON files, and reflect your filesystem's structure directly in your data, all with just a few lines of code.
Moreover, json-fusion
provides a special handling for index.json
files. The contents of index.json
files are expanded directly into the parent directory's key, rather than creating a separate index key. This allows more intuitive organization of your JSON files.
index.json
files, which are expanded directly under the parent directory's keynpm install json-fusion
Here's a basic example of how to use json-fusion:
const jsonFusion = require('json-fusion');
const path = './path/to/your/json/files';
const result = await jsonFusion(path);
console.log(result);
import jsonFusion from 'json-fusion';
const path = './path/to/your/json/files';
const result = await jsonFusion(path);
console.log(result);
Consider the following directory structure:
/path/to/your/json/files
├── config.json
├── users
│ ├── index.json
│ ├── john.json
│ └── jane.json
└── data
├── items.json
└── purchases.json
Running jsonFusion('./path/to/your/json/files')
would result in an object similar to:
{
"config": {/** ./config.json */},
"users": {
/** index.json */
"john": {/** ./users/john.json */},
"jane": {/** ./users/jane.json */}
},
"data": {
"items": {/** ./data/items.json */},
"purchases": {/** ./data.purchases.json */}
}
}
where {/** */}
represents the contents of the corresponding JSON file.
jsonFusion(path, options)
path
- The path to the directory containing your JSON files.options
- An optional object containing the following options:
exportType
- The type of export to use. Defaults to json
. Can be one of the following:
json
- Exports the resulting object as a JSON string.yaml
- Exports the resulting object as a YAML string. required yaml
packageobject
- Exports the resulting object as a JavaScript object.ignore
- An array of file names to ignore. Defaults to ['index.json']
.cwd
- The current working directory to use. Defaults to process.cwd()
.export
- If you want to export the result to a file, you can set the path to the file to be exported.extensions
- An array of file extensions to include. Defaults to ['json']
.
json
- JSON filesyaml
- YAML files. required yaml
packagenoSpreadIndex
- If you want to disable the special handling for index.json
files, set this to true
. Defaults to false
.see CONTRIBUTING.md
FAQs
Json-Fusion is a Node.js library designed to streamline the process of loading, merging, and reflecting directory hierarchies in JSON files. With Json-Fusion, you can consolidate information scattered across different JSON files, and reflect your filesyst
The npm package json-fusion receives a total of 374 weekly downloads. As such, json-fusion popularity was classified as not popular.
We found that json-fusion 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.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.