0.0.2 • Published 2 years ago

rs-csvto-json v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

CSVtoJSONLibrary

This project was generated with Angular CLI version 10.0.5.

CSV Format => JSON Format

Demo Link

Stackblitz Demo

Step - 1

npm i ngx-csvto-json --save
NPM Package Link

import NgxCSVtoJSONModule in app.module.ts file.
app.module.ts

import {NgxCSVtoJSONModule} from 'ngx-csvto-json';
 imports: [
    NgxCSVtoJSONModule
  ]

Step - 2

Use selector "Ngx-CSVtoJSON" to use the converter component
Note: This component can emit two events "onConvert" and "onFail"
Bind those event in app.component.ts file with user defined functions and process the result
app.component.ts

convert(objArray){
  console.log(objArray);
 }
 onError(err){
   console.log(err);
 }

app.component.html

<Ngx-CSVtoJSON (onConvert)="convert($event)" (onFail)="onError($event)"></Ngx-CSVtoJSON>

CONVERTED RESULT FORMAT

Result format will be in

finalobj= {
 properties: [],
 result: []
};

That's it you are good to go. Happy Coding :)