CSVtoJSONLibrary
This project was generated with Angular CLI version 10.0.5.
Demo Link
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 :)