Answers for "how to write in json file in java script"

9

HOW WRITE AND SAVE JSON FILE IN NODEJS

'use strict';

const fs = require('fs');

let student = { 
    name: 'Mike',
    age: 23, 
    gender: 'Male',
    department: 'English',
    car: 'Honda' 
};
 
let data = JSON.stringify(student, null, 2);

fs.writeFile('student-3.json', data, (err) => {
    if (err) throw err;
    console.log('Data written to file');
});

console.log('This is after the write call');
Posted by: Guest on September-30-2020
6

js writing to json file

var fs = require('fs');

var data = {}
data.table = []
for (i=0; i <26 ; i++){
   var obj = {
       id: i,
       sq
Posted by: Guest on March-23-2020

Code answers related to "how to write in json file in java script"

Code answers related to "Javascript"

Browse Popular Code Answers by Language