I would like to add an even simpler way to do this, using the built-in json
pipe:
<pre>{{data | json}}</pre>
This way, the formatting is preserved.
More Related Contents:
- Filter JSON by key value with JavaScript
- Angular 5 Service to read local .json file
- ngRepeat Filter by deep property
- Separate Angular2 TypeScript files and JavaScript files into different folders, maybe ‘dist‘
- Whats the difference between using a class and interface?
- Load JSON content from a local file with http.get() in Angular 2
- How to insert into JSON?
- How do I return the response from an Observable/http/async call in angular?
- Property ‘…’ has no initializer and is not definitely assigned in the constructor
- Is the order of elements in a JSON list preserved?
- jQuery.parseJSON throws “Invalid JSON” error due to escaped single quote in JSON
- Sum JavaScript object propertyA values with the same object propertyB in an array of objects
- How to convert JSON to CSV format and store in a variable
- Merge keys array and values array into an object in JavaScript
- Wait for multiple promises to finish
- How might I extract the property values of a JavaScript object into an array?
- Is this simple string considered valid JSON?
- Angular 2: Callback when ngFor has finished
- Upgrading to angular-6.x gives “Uncaught ReferenceError: global is not defined”
- Angular2 router 2.0.0 not reloading components when same url loaded with different parameters?
- How to subscribe to an event on a service in Angular2?
- Not a Legal JSONP API — How to get data without CALLBACK parameter
- d3 js – loading json without a http get
- Removing undefined values from Array
- How to use onBlur event on Angular2?
- IE10/11 Ajax XHR error – SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3
- TypeError: Converting circular structure to JSON in nodejs
- How to check empty object in angular 2 template using *ngIf
- XML parser for JavaScript [closed]
- Recursive tree search in a nested object structure in JavaScript