1.0.3 • Published 5 years ago

json-restyle v1.0.3

Weekly downloads
10
License
ISC
Repository
github
Last release
5 years ago

JSON Restyle

This is a simple library to renames JSON data keys.

Quick links

Example application | StackBlitz example

Installing and usage

npm install json-restyle --save
Load the module for your app:
import { JsonRestyleModule } from 'json-restyle'

@NgModule({
  ...
  imports: [
    ...
    JsonRestyleModule
  ]
})
Use it in component:
import { JsonRestyleService } from 'json-restyle';

public constructor(private jsonService: JsonRestyleService) { }

/* Data to be modified */
let data = {
    "version": "0.0.1",
    "name": "json-restyle",
    "description": "Reforms json object",
    "feature": "json object key renaming"
};

/* "old key name" : "new key name" */
let jsonOptions = {
    'version': 'ver',
    'name': 'projName'
};
let modifiedJsonData = this.jsonService.reform(data, jsonOptions);