15

I'm facing these issues in angular 12 version, I'm unable to connect the JSON file

2
  • 2
    What issues? Please add them to the body of your question. Commented May 24, 2021 at 15:48
  • Should this be tagged [angular] instead of [angularjs] since it isn't AnglarJS 1.x related? Commented Jul 12, 2021 at 3:09

2 Answers 2

52

Place the below setting into compilerOptions of tsconfig.json. See the example here

"resolveJsonModule": true,
"esModuleInterop": true,
Sign up to request clarification or add additional context in comments.

1 Comment

Still getting the same error, even with this in both tsconfig.json and tsconfig.vite.json, using Vite.
4

create a file named "json-typings.d.ts" in your app directory and paste the code below.

declare module "*.json" {
    const value: any;
    export default value;
}

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.