Garmaine Staff asked 2 years ago
This question already has answers here:”>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.