Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
AnViL999
Frequent Visitor

Visual.ts import assets/file.geojson

Hello,

 

How can I import from assets a file called file.geojson into visual.ts? I currently have the value stored in visual.ts itself.

 

I am having a hard time finding the answer online.

 

With kind regards,

 

AnViL

 

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

Hi @AnViL999,

 

Add "resolveJsonModule": true to your tsconfig.json file's compilerOptions.

 

You can then import a JSON file into your code as a variable.

 

TypeScript doc

 

I use this in pretty much all visuals I write, and some examples can be seen in Deneb [tsconfig | usage in a file, with link to import lines].

 

Good luck!

 

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




View solution in original post

2 REPLIES 2
dm-p
Super User
Super User

Hi @AnViL999,

 

Add "resolveJsonModule": true to your tsconfig.json file's compilerOptions.

 

You can then import a JSON file into your code as a variable.

 

TypeScript doc

 

I use this in pretty much all visuals I write, and some examples can be seen in Deneb [tsconfig | usage in a file, with link to import lines].

 

Good luck!

 

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




AnViL999
Frequent Visitor

@dm-p 

That did the trick! Thank you

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors