# angular4-jsoneditor

> Angular 4 Json Editor (wrapper for jsoneditor). View/Edit Json file with formatting.

Latest version **1.0.7** (published 2017-08-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install angular4-jsoneditor
pnpm add angular4-jsoneditor
yarn add angular4-jsoneditor
bun add angular4-jsoneditor
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2017-08-09 |
| First published | 2017-08-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 13 |
| Known vulnerabilities | 0 (+26 in 5 direct dependencies) |
| Install scripts | no |
| GitHub stars | 39 |
| Author | Manish Sodavadiya |
| Maintainers | manish_it56 |
| Keywords | angular4, jsoneditor, angular4-jsoneditor, ng4-jsoneditor, angular |

## Links

- npm: https://www.npmjs.com/package/angular4-jsoneditor
- Repository: https://github.com/manishit56/Angular4-JsonEditor
- Issues: https://github.com/manishit56/Angular4-JsonEditor/issues
- npm.io page: https://npm.io/package/angular4-jsoneditor

## Dependencies (13)

- [rxjs](https://npm.io/package/rxjs.md) ^5.1.0
- [core-js](https://npm.io/package/core-js.md) ^2.4.1
- [zone.js](https://npm.io/package/zone.js.md) ^0.8.4
- [jsoneditor](https://npm.io/package/jsoneditor.md) ^5.9.3
- [@angular/core](https://npm.io/package/@angular/core.md) ^4.0.0
- [@angular/http](https://npm.io/package/@angular/http.md) ^4.0.0
- [@angular/forms](https://npm.io/package/@angular/forms.md) ^4.0.0
- [@angular/common](https://npm.io/package/@angular/common.md) ^4.0.0
- [@angular/router](https://npm.io/package/@angular/router.md) ^4.0.0
- [@angular/compiler](https://npm.io/package/@angular/compiler.md) ^4.0.0
- [@angular/animations](https://npm.io/package/@angular/animations.md) ^4.0.0
- [@angular/platform-browser](https://npm.io/package/@angular/platform-browser.md) ^4.0.0
- [@angular/platform-browser-dynamic](https://npm.io/package/@angular/platform-browser-dynamic.md) ^4.0.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

- 1.0.7 (latest) — 2017-08-09
- 1.0.6 — 2017-08-09
- 1.0.5 — 2017-08-09
- 1.0.4 — 2017-08-09
- 1.0.3 — 2017-08-09
- 1.0.2 — 2017-08-09
- 1.0.1 — 2017-08-09
- 1.0.0 — 2017-08-08

## README

# Angular 4 Json Editor

Angular 4 Json Editor (wrapper for jsoneditor). View/Edit Json file with formatting.

## Installation

To install this library with npm, run below command:

$ npm install --save angular4-jsoneditor

## Usage

### Configuration

First, Import Angular 4 JsonEditor module in root

```ts
import { Ng4JsonEditorModule } from 'angular4-jsoneditor' 

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    ....,
    Ng4JsonEditorModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
```
Then setup your component models as below :

```ts
import { Component, ViewChild } from '@angular/core';
import { JsonEditorComponent, JsonEditorOptions } from 'angular4-jsoneditor/jsoneditor/jsoneditor.component';

@Component({
  selector: 'app-root',
  template: '<json-editor [options]="editorOptions" [data]="data"></json-editor>',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  public editorOptions: JsonEditorOptions;
  public data: any;
  @ViewChild(JsonEditorComponent) editor: JsonEditorComponent;

  constructor() { 
    this.editorOptions = new JsonEditorOptions()
    this.editorOptions.modes = ['code', 'text', 'tree', 'view']; // set all allowed modes
    //this.options.mode = 'code'; //set only one mode
      
      this.data = {"products":[{"name":"car","product":[{"name":"honda","model":[{"id":"civic","name":"civic"},{"id":"accord","name":"accord"},{"id":"crv","name":"crv"},{"id":"pilot","name":"pilot"},{"id":"odyssey","name":"odyssey"}]}]}]}
  }

}
```
Note : For better styling, add below line to your main style.css file

```ts
@import "~jsoneditor/dist/jsoneditor.min.css";
```
# Demo
Demo component files are included in Git Project.

Demo Project:
[https://github.com/manishit56/Angular4-JsonEditor/tree/master/src/app/demo)

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