- If NodeJS not installed in your system. Install it from Here.
- Clone the repository.
- Run command
npm i
in root folder to install dependencies. - Run command
npm run build
in the root folder to build. - Run command
npm run test
in the root folder to test. - That's it.
npm i prodata-app
Code Sample
const { parseJsonFile } = require("prodata-app");
parseJsonFile("./files/demo.json").then((res) => console.log(res));
The input files are from here
First input file 1.json
The output
{
"message": [
{
"node": 1,
"result": true
}
]
}
Second input file 2.json
The output
{
"message": [
{
"node": 1,
"result": false
},
{
"node": 2,
"result": false
},
{
"node": 3,
"result": true
}
]
}
There are two functions
parseJsonFile
parseJsonString
ParseJsonFile()
- @params : String. JSON file path
- @returns : Promise. A JSON format text
- @type: : async
ParseJsonString()
- @params : String. JSON string
- @returns : String. A JSON format text
- @type: : sync