How to use a JSON file in TypeScript?

RE:

You can import only .ts or .tsx file using typescript imports

This can be done in two ways: a)if you want to import JSON you may have to use "require"

b) Copy the json and assign the JSON to a varaible and store it in a .ts file . In this case the variable will hold the json object . You can now import this .ts file using typescript type of imports and start using the object

tried option 2 on systemjs loading, it works!

Reply to this…

(3 answers) Take me to the question