Answers for "import from json javascript node 1610"

1

import json javascript

// example.json
{
    "name": "testing"
}


// ES6/ES2015
// app.js
import * as data from './example.json';
const {name} = data;
console.log(name); // output 'testing'
Posted by: Guest on July-28-2021
0

nodejs include json file

config = require("./yourfile.json"); // Note, "config" can be changed to your liking.
Posted by: Guest on January-15-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language