Garmaine Staff asked 1 year ago
This question already has answers here:
http://stackoverflow.com//questions/37308420/angular-2-pipe-that-transforms-json-object-to-pretty-printed-json”>Angular 2 pipe that transforms JSON object to pretty-printed JSON (4 answers)
Closed 2 hours ago.

I've been looking for a nice way to display JSON and all the answers have a few solutions, but no matter what I try it just makes it one long line with no formatting. These are all the things I've tried.

<div>{{ jsonValue | json }}</div>

<pre>{{ jsonValue | json}}</pre>

<pre [innerHtml]="jsonValue"></pre>

import {PrettyJsonModule} from 'angular2-prettyjson'; <pre [innerHtml]="eligibilityView | prettyjson:3"></pre>

import {PrettyJsonModule} from 'angular2-prettyjson'; <pre>{{ eligibilityView | prettyjson:3 }}</pre>

From all the questions I've seen asked, one of these should work, but they all are only a single line with no formatting.