How to Import json into TypeScript
Jecelyn Yeen
65411

Yup, it does indeed work with angular-cli apps.

The key is to be sure to add the declaration to the typings.d.ts file. I did mine like this then restarted ng serve.

/* SystemJS module definition */
declare module "*.json"{
const value: any;
export default value;
}
declare var module: NodeModule;
interface NodeModule {
id: string;
}

@jecelenyeen Thanks for sharing this!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.