# ngx-json-viewer

> JSON formatter / viewer for Angular

Latest version **3.2.1** (published 2022-11-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install ngx-json-viewer
pnpm add ngx-json-viewer
yarn add ngx-json-viewer
bun add ngx-json-viewer
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.1 |
| Published | 2022-11-21 |
| First published | 2017-07-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 83.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 181 |
| Author | Vivo Xu |
| Maintainers | hivivo |
| Keywords | angular, json |

## Links

- npm: https://www.npmjs.com/package/ngx-json-viewer
- Repository: https://github.com/hivivo/ngx-json-viewer
- Homepage: https://github.com/hivivo/ngx-json-viewer#readme
- Issues: https://github.com/hivivo/ngx-json-viewer/issues
- npm.io page: https://npm.io/package/ngx-json-viewer

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.3.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 3.2.1 (latest) — 2022-11-21
- 3.2.1-alpha.0 — 2022-10-25
- 3.2.0 — 2022-10-25
- 3.1.0 — 2022-06-18
- 3.0.2 — 2021-01-08
- 3.0.1 — 2021-01-08
- 3.0.0 — 2021-01-08
- 2.4.0 — 2018-10-28
- 2.3.1 — 2018-08-18
- 2.3.0 — 2018-06-12
- 2.2.0 — 2018-02-25
- 2.1.0 — 2018-02-09
- 2.0.4 — 2018-02-02
- 2.0.3 — 2018-01-29
- 2.0.2 — 2018-01-27
- … 5 more at https://npm.io/package/ngx-json-viewer/versions

## README

# ngx-json-viewer

JSON formatter and viewer for Angular

Live demo:
- Angular 14: https://stackblitz.com/edit/angular-14-ngx-json-viewer
- Angular 5: https://stackblitz.com/edit/ngx-json-viewer

## Install
```bash
npm install ngx-json-viewer
```

or

```bash
yarn add ngx-json-viewer
```

For older Angular:

```bash
# For Angular 4/5/6/7+:
npm install ngx-json-viewer@2

# For Angular 2:
npm install ngx-json-viewer@1
```

NPM Package: https://www.npmjs.com/package/ngx-json-viewer

## Usage

In your `app.module.ts` import `NgxJsonViewerModule` like
```js
import { NgxJsonViewerModule } from 'ngx-json-viewer';

@NgModule({
  ...,
  imports: [
    ...,
    NgxJsonViewerModule,
    ...
  ],
  ...
})
export class AppModule { }
```

In your component:
```html
<ngx-json-viewer [json]="someObject"></ngx-json-viewer>
```

To collapse all nodes at first:
```html
<ngx-json-viewer [json]="someObject" [expanded]="false"></ngx-json-viewer>
```

To only expand 3 levels:
```html
<ngx-json-viewer [json]="someObject" [depth]="3"></ngx-json-viewer>
```

### Theming

Theming can be done with CSS variables

* --ngx-json-string : color of string values
* --ngx-json-number : color of number values
* --ngx-json-boolean : color of boolean values
* --ngx-json-date : color of date values
* --ngx-json-array : color of array values
* --ngx-json-object : color of object values
* --ngx-json-function : color of function values
* --ngx-json-null : color of null values
* --ngx-json-null-bg : background color of null values
* --ngx-json-undefined : color of undefined values
* --ngx-json-toggler : color of toggler
* --ngx-json-key : color of keys
* --ngx-json-separator : color of separators
* --ngx-json-value : color of values
* --ngx-json-undefined-key : color for key of undefined values
* --ngx-json-font-family : font-family 
* --ngx-json-font-family : font-size

---
_Source: https://npm.io/package/ngx-json-viewer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
