https://github.com/avoidwork/csv.js
Encodes JSON, Arrays or Objects to CSV
https://github.com/avoidwork/csv.js
Last synced: 3 months ago
JSON representation
Encodes JSON, Arrays or Objects to CSV
- Host: GitHub
- URL: https://github.com/avoidwork/csv.js
- Owner: avoidwork
- License: bsd-3-clause
- Archived: true
- Created: 2013-05-19T21:45:55.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2022-10-07T11:22:44.000Z (over 3 years ago)
- Last Synced: 2025-10-22T12:50:02.843Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 267 KB
- Stars: 72
- Watchers: 6
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# csv.js
Simplify encoding & decoding CSV. Easy exporting from an API, or reformatting on a Client!
[](http://travis-ci.org/avoidwork/csv.js)
## Example
```javascript
var csv = require( "csv.js" );
var encoded = csv.encode( [{prop: "value"}, {prop: "value2"}] );
console.log( encoded );
//
prop
value
value2
```
## API
### encode( arg[, delimiter, header] )
Encodes `arg` as CSV. The optional `delimiter` allows you change the default `comma`. The optional `header` allows you to disable the first row of column names by passing `false`.
### decode( arg[, delimiter] )
Decodes `arg` to an `Array` of `Objects`. The optional `delimiter` allows you to specify the delimiter if it is not a `comma`.
## How can I load csv.js?
csv.js supports AMD loaders (require.js, curl.js, etc.), CommonJS, node.js & npm (npm install csv.js), or using a script tag.
## License
csv.js is licensed under BSD-3 https://raw.github.com/avoidwork/csv.js/master/LICENSE
## Copyright
Copyright (c) 2021, Jason Mulligan