Create the toJSON operator in Angular
Netanel Basal

This would definitely work, but seems a little dangerous to be modifying an external library’s (RxJS) prototype. In the future this would also become a native JavaScript object, so again modifying it like this is probably not a future-proof approach.

I would prefer to handle data fetching within a component dedicated to data fetching and parsing and using the built in json pipe operator or a custom pipe to transform it into JSON.

An example of this can be found within the docs: (towards the bottom of the page)

A single golf clap? Or a long standing ovation?

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