As of node v0.5.x yes you can require your JSON just as you would require a js file.
var someObject = require('./somefile.json')
In ES6:
import someObject from ('./somefile.json')
Related Contents:
- Proper way to return JSON using node or Express
- How can I pretty-print JSON using node.js?
- Is there a way to automatically build the package.json file for Node.js projects
- How do I consume the JSON POST data in an Express application
- How do you log content of a JSON object in Node.js?
- How do I add environment variables to launch.json in VSCode
- Convert a JSON Object to Buffer and Buffer to JSON Object back
- Writing JSON object to a JSON file with fs.writeFileSync
- How to update a value in a json file and save it through node.js
- pass JSON to HTTP POST Request
- Convert Mongoose docs to json
- How to return a complex JSON response with Node.js?
- In node package.json, invoke script from another script with extra parameter, in this case add mocha watcher
- Edit package.json from command line
- Get a JSON via HTTP request in NodeJS
- NodeJS HttpGet to a URL with JSON response
- npm notice created a lockfile as package-lock.json. You should commit this file
- Node.js -Firebase Service Account Private Key won’t parse
- Looping through JSON with node.js
- Node events.js:167 throw er; // Unhandled ‘error’ event
- Using Node.JS, how do I read a JSON file into (server) memory?
- How do I cast a JSON Object to a TypeScript class?
- Detect if called through require or directly by command line
- Handling JSON Post Request in Go
- How to escape special characters in building a JSON string?
- Is there a query language for JSON?
- How do you represent a JSON array of strings?
- How do I update a single value in a json document using jq?
- Partly JSON unmarshal into a map in Go
- Unhandled Exception: InternalLinkedHashMap’ is not a subtype of type ‘List
- Correctly Parsing JSON in Swift 3
- How to parse JSON in Scala using standard Scala classes?
- curl json post request via terminal to a rails app
- No serializer found for class org.hibernate.proxy.pojo.javassist.Javassist?
- change json file by bash script
- How to convert CSV to JSON in Node.js
- Difference between json.js and json2.js
- Representing logic as data in JSON
- Install jq JSON processor on Ubuntu 10.04
- How to filter array of objects by element property values using jq?
- How to POST a JSON object to a JAX-RS service
- Load node.js module from string in memory
- Serialize in JSON a base64 encoded data
- Protocol Buffer vs Json – when to choose one over another
- JSON values 1 or 0 – int or boolean
- how to parse json using groovy
- downloading jackson.codehaus.org jar
- How to use VS Code debugger with webpack-dev-server (breakpoints ignored)
- How to interact with Telegram API
- How to convert a string to an integer in a JSON file using jq?