
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
node js module responsible for parsing JSON files and providing information about them
This npm package provides two main functions: loadJSONFile, getJSONShape and getByTag. These functions are designed to work with JSON data and perform the following tasks:
getJSONShape(json)json (Object or Array): The JSON object or array for which you want to determine the shape.const { getJSONShape } = require("json-scan");
const json = {
name: "John",
age: 30,
isStudent: true,
hobbies: ["reading", "swimming"],
address: {
city: "New York",
zipCode: "10001",
},
};
const shape = getJSONShape(json);
This is the result we would obtain when performing console.log(shape)
{
"name": "string",
"age": "number",
"isStudent": "boolean",
"hobbies": ["string"],
"address": {
"city": "string",
"zipCode": "string"
}
}
In the example above, getJSONShape will return an object representing the shape of the JSON structure, including the types of each element.
getByTagThis function allows you to search for objects within a JSON structure that contain a specified tag. It recursively searches through the JSON structure to find objects with the desired tag.
const { getByTag } = require("json-scan");
const json = {
name: "Damian",
surname: "Sire",
venue: {
name: "Google",
address: "dummy",
},
family: [
{
name: "Person1",
surname: "DummySurname",
venue: {
name: "Place1",
address: "Address1",
},
family: [],
},
{
name: "Person2",
surname: "Surname2",
venue: {
name: "Place2",
address: "Address2",
},
family: [],
},
],
};
const tag = "name";
const result = getByTag(json, tag);
The result we would obtain would be the following
{
"name": "Damian",
"venue": {
"name": "Google",
},
"family": [
{
"name": "Person1",
"venue": {
"name": "Place1",
},
},
{
"name": "Person2",
"venue": {
"name": "Place2",
},
}
]
}
loadJSONFileThis function is used to asynchronously load and parse a JSON file from a specified file path.
const loadJSONFile = require("json-scan");
(async () => {
try {
const data = await loadJSONFile(filePath);
console.log(data); // Parsed JSON data
} catch (error) {
console.error(error.message);
}
})();
To use this package in your project, you can install it via npm:
npm install json-scan
If you encounter any issues or have suggestions for improvements, please open an issue on the GitHub repository of this package.
Contributions are welcome! Feel free to fork the repository and submit pull requests.
Damian Sire - LinkedIn - Twitter
Anyone can use this library for free.
Thank you for using our npm package! We hope it helps you work with JSON data more efficiently. If you have any questions or need further assistance, please don't hesitate to contact us.
Happy coding!
FAQs
node js module responsible for parsing JSON files and providing information about them
The npm package json-scan receives a total of 1 weekly downloads. As such, json-scan popularity was classified as not popular.
We found that json-scan 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.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.