import json file javascript

JavaScript
const fs = require('fs');
const path = require('path');

let student = { 
    name: 'Mike',
    age: 23, 
    gender: 'Male',
    department: 'English',
    car: 'Honda' 
};
 
fs.writeFileSync(path.resolve(__dirname, 'student.json'), JSON.stringify(student));
// if you're using node.js, you can use require(.json):
// in list.json:
[{"name":"John","age":"17"},{"name":"Jack","age":"36"},{"name":"Rick","age":"76"}]

//in js
const list = require( 'list.json' );
console.log(list);
// output:
// 0: Name: "John", Age: "17"
// 1: Name: "Jack", Age: "36"
// 2: Name: "Rick", Age: "76"
Source

Also in JavaScript: