typescript read json file
add to tsconfig.json
{
...
"resolveJsonModule": true
}
}// data.json:
{
"greeting" : "xin chao Vietnam"
}
// component:
import * as data from 'data.json';
let greeting = data.greeting;
//registering jsonModule in tsconfig.json
"compilerOptions": {
....
"resolveJsonModule": true,
....
},"resolveJsonModule": true,
"esModuleInterop": true,
import {default as a} from "config.json";
config.targetKey
// this requires `"resolveJsonModule": true` in tsconfig.jsonimport {default as a} from "a.json";
a.primaryMain
Also in JavaScript:
- spreadjs autofit column with minimum
- js script
- how to add first child using js
- to upper javascrit
- disabled radio button
- javascript for loop 5 times
- how to write to a file with javascript without nodejs
- reload a child component in angular
- update node on windows
- turn object to json javascript
- document delete element
- error metro bundler process exited with code 1 react native
- how to cut off decimals in javascript
- remove header from certain pages react navigation
- angular get current time
- javascript modal
- display none after hover
- how to install node js in ubuntu
- fetch api based on id nodejs and mongodb
- ejs comments
- loop through object js
- loop through object javascript
- adding numbers in an array javascript
- jquery append table row