Forum Discussion
Show version or displayName from pbiviz.json on visual
- 3 years ago
Hi Anonymous,
Add "resolveJsonModule": true to the compilerOptions in your tsconfig.json [documentation].
Add an import in the desired .ts file for your pbiviz.json. Assuming that you're using src/visual.ts, this would look something like the following:
import * as pbiviz from '../pbiviz.json';You can now access the JSON from pbiviz.json as if it were an object, e.g.:
pbiviz.visual.displayName;I'm using this in Deneb for a similar reason. You can see where I'm doing this here if you need it for reference.
Regards,
Daniel
Hi Anonymous,
Add "resolveJsonModule": true to the compilerOptions in your tsconfig.json [documentation].
Add an import in the desired .ts file for your pbiviz.json. Assuming that you're using src/visual.ts, this would look something like the following:
import * as pbiviz from '../pbiviz.json';
You can now access the JSON from pbiviz.json as if it were an object, e.g.:
pbiviz.visual.displayName;
I'm using this in Deneb for a similar reason. You can see where I'm doing this here if you need it for reference.
Regards,
Daniel
Yes! 👍
As simple as that.
Thanks a lot.