Answers for "convert json file to object javascript"

5

convert data into json format in javascript

Use the JavaScript function JSON.parse() to convert text into a JavaScript object:
var obj = JSON.parse('{ "name":"John", "age":30, "city":"New York"}');
Posted by: Guest on June-07-2020
-1

read json file into object javascript

fs.readFile(filePath, function (error, content) {
    var data = JSON.parse(content);
    console.log(data.collection.length);
});
Posted by: Guest on April-27-2021
0

json file to object js

var data = JSON.parse(fs.readFileSync(filePath));
Posted by: Guest on August-04-2021

Code answers related to "convert json file to object javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language