Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
ngx-rich-json-csv-parser
Advanced tools
convert JSON to CSV file and Download it in the .csv format for your Angular project
Ngx-rich-json-csv-parser help you to convert JSON to CSV file and Download it in the .csv format.
Start by installing the Angular Rich JSON CSV Parser library from npm
npm i -s ngx-rich-json-csv-parser
Next, you'll need to import the NgxRichJsonCsvParserModule module in your app's module.
app.module.ts
import { NgxRichJsonCsvParserModule } from 'ngx-rich-json-csv-parser';
...
@NgModule({
...
imports: [NgxRichJsonCsvParserModule],
...
});
Next, To consume this library, create a instance of this library service in component ts file. eg csv-download-example.component.ts
import { Component } from '@angular/core';
import { HeaderCaseMode, HeaderSortMode, NgxRichJsonCsvParserService } from 'ngx-rich-json-csv-parser';
...
export class CSVDownloadExampleComponent {
jsonData = []; //your JSON data to convert CSV
constructor(private _ngxRichJsonCsvParserService: NgxRichJsonCsvParserService) {
}
download() { // Sample function to covert JSON data to CSV and download CSV file
this._ngxRichJsonCsvParserService.downloadFile(this.jsonData, [], true, 'test', 'mySl', SortMode.DESC, HeaderCaseMode.StartCase);
}
}
this._ngxRichJsonCsvParserService.downloadFile(<Your JSON Data>,<Custom Header List>,<show Serial Number(boolean)>,<Your CSV File Name>,< your Serial Number Header Name>, < Sort Header list>,<Format your CSV headers text cases> );
Order | Name | Type | Details |
---|---|---|---|
1 | JSON Data | An array of objects | JSON data which is used to convert into CSV |
2 | Custom Header | An array of String | You can provide custom csv header name, please note number of element in this header array should be equal to number of property in single JSON array object data |
3 | isAutoGenerateSlNo(IsGenerateSerial Number) | Boolean | This flag is used to generate Numerical serial number start from 1 |
4 | CSV File Name | string | Your custom CSV file name |
5 | Serial Number header name | string | If isAutoGenerateSlNo is true then you can provide custom header for Serial number |
6 | Sort CSV Header list | enum | To sort CSV Header list, available options are - without Sorting : HeaderSortMode.NONE - to sort ascending order: HeaderSortMode.ASC - to sort descending order: HeaderSortMode.DESC |
7 | Header Text format | enum | To format CSV all header text to uppercase or lowercase or capitalize or startcase(title case) eg: HeaderCaseMode.StartCase |
this._ngxRichJsonCsvParserService.downloadFile(jsonData, [], true, 'test', 'mySl', SortMode.DESC, HeaderCaseMode.StartCase); //example
this._ngxRichJsonCsvParserService.ConvertToCSV(this.jsonData, [], true, 'mySl', HeaderSortMode.DESC, HeaderCaseMode.StartCase); // this function returns csv data
Order | Name | Type | Details |
---|---|---|---|
1 | JSON Data | An array of objects | JSON data which is used to convert into CSV |
2 | Custom Header | An array of String | You can provide custom csv header name, please note number of element in this header array should be equal to number of property in single JSON array object data |
3 | isAutoGenerateSlNo(IsGenerateSerial Number) | Boolean | This flag is used to generate Numerical serial number start from 1 |
4 | Serial Number header name | string | If isAutoGenerateSlNo is true then you can provide custom header for Serial number |
5 | Sort CSV Header list | enum | To sort CSV Header list, available options are - without Sorting : HeaderSortMode.NONE - to sort ascending order: HeaderSortMode.ASC - to sort descending order: HeaderSortMode.DESC |
6 | Header Text format | enum | To format CSV all header text to uppercase or lowercase or capitalize or startcase(title case) eg: HeaderCaseMode.StartCase |
const c = this._ngxRichJsonCsvParserService.ConvertToCSV(this.jsonData, [], true, 'mySl', HeaderSortMode.DESC, HeaderCaseMode.StartCase);
console.log(c) //example
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
FAQs
convert JSON to CSV file and Download it in the .csv format for your Angular project
The npm package ngx-rich-json-csv-parser receives a total of 0 weekly downloads. As such, ngx-rich-json-csv-parser popularity was classified as not popular.
We found that ngx-rich-json-csv-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.