node json code example
Example 1: read json file nodejs
const fs = require('fs');
const path = require('path');
let rawdata = fs.readFileSync(path.resolve(__dirname, 'student.json'));
let student = JSON.parse(rawdata);
console.log(student);
Example 2: js string to json
var obj = JSON.parse("{no:'u',my:'sql'}");//returnes {no:'u',my:'sql'}