Studio: Importing JSON data to .ts file

Hello :wave:

I have a JSON file LevelData.json in my file system that I want to pull into my manager class - how would I go about that? I tried importing the data using import * as levelData from ./LevelData.json but get an error: Cannot find module './LevelData.json. Consider using '--resolveJsonModule' to import module with '.json' extension. From what I can tell, that needs to be added to a tsconfig.json file which I can’t find.

I’m guessing I’m going about it the wrong way? Still a bit of a TypeScript noob, bear with me :sweat_smile: any help would be very much appreciated!

Hi!

You’re actually going about it the right way! Give yourself more credit! :smiley: We haven’t enabled the resolveJsonModule yet, which means you’ll have to manually copy and paste your JSON data into your .ts or .js files directly to use the data.