WebReflection/circular-json

How to include this circular-json plugin in our Angular 4 application

PrithiviRajG opened this issue · 2 comments

I am getting circular JSON exception on catching the error logs so I am trying to use this in my project which is developed in angular 4. Please help us to add this in our project.

It’s a node module. Can’t you just import it? I’ve no idea about Angular 4

I am able to use this in our Angular 4 project after few struggles. I will add the instructions for Angular 4 implementation below so others can use it if they struck like me.

  1. Run npm install --save circular-json command in your project to install circular-json
  2. Run npm install --save @types/circular-json command in your project. These are Type definition files which provide better experience when using JS libraries with auto completion and type checking
  3. Add import * as CircularJSON from 'circular-json'; in the top of your component or service where your want to use circular-json
  4. Get the string of your circular-json with this code let error : string = CircularJSON.stringify(err);

Thanks for this wonderful plugin :)