I want to save a file containing request body in json and use it as in input for my nodejs application which makes api call to a soap service. I also want to save the response body in to mongodb. I am using the Node.js fs module for this. Can you please suggest how to loop through the json file using the fs module?
Here is how my file looks like
[{
"name": "Sara",
"age": 23,
"gender": "Female",
"department": "History",
"car": "Honda"
},{}
]
Here is what I have for a starter.
'use strict';
const fs = require('fs');
let rawdata = fs.readFileSync('student.json');
let student = JSON.parse(rawdata);
console.log(student.name);