title: Importing JSON file in Node Typescript
body: <p>I have tried every solution found online but it seems I cannot get my specifics resolved.</p>
  
  <p>I am trying to import a static .json file into a node controller, all in TypeScript.</p>
  
  <p>The error I'm getting is </p>
  
  <blockquote>
    <p>Cannot find module  './data.map.json'</p>
  </blockquote>
  
  <p>I've checked the path 100 times it's definitely correct. I have tried every combination of require vs import, and every option I could find in tsconfig.json, which is where I believe the problem lies.</p>
  
  <p>Below is a clean minimal example showing my setup. How can I import a static json file in my Typescript application?</p>
  
  <p><em>controller</em></p>
  
  <pre><code>import * as data from "./data.map.json";
  </code></pre>
  
  <p><em>typings.d.ts</em></p>
  
  <pre><code>declare module "*.json" {
      const value: any;
      export default value;
  }
  </code></pre>
  
  <p><em>tsconfig.json</em></p>
  
  <pre><code>{
    "compilerOptions": {
      "outDir": "build",
      "target": "es6",
      "module": "commonjs",
      "moduleResolution": "node",
      "sourceMap": true,
      "typeRoots": ["node_modules/@types"],
      "paths": {
        "*": ["typings.d.ts"]
      }
    },
    "files": [
      "typings.d.ts"
    ],
    "include": [
      "src/**/**.ts",
      "test/**/**.ts"
    ],
    "exclude": [
      "node_modules"
    ],
    "compileOnSave": false
  }
  </code></pre>