Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Show version or displayName from pbiviz.json on visual

I want to show version or displayName from pbiviz.json in my visual. In small print just to make it easy for knowing which reports need new versions of my visual.   I can not find a method to acce...
  • dm-p's avatar
    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