https://github.com/duologic/csv-libsonnet
Jsonnet library to parse CSV files.
https://github.com/duologic/csv-libsonnet
jsonnet jsonnet-libs
Last synced: 4 months ago
JSON representation
Jsonnet library to parse CSV files.
- Host: GitHub
- URL: https://github.com/duologic/csv-libsonnet
- Owner: Duologic
- License: gpl-3.0
- Created: 2025-06-01T22:10:36.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-06-03T12:33:07.000Z (12 months ago)
- Last Synced: 2025-06-22T21:36:28.412Z (11 months ago)
- Topics: jsonnet, jsonnet-libs
- Language: Jsonnet
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# csv-libsonnet
Jsonnet library to parse CSV files.
It parses files according to [RFC4180](https://datatracker.ietf.org/doc/html/rfc4180). It also accepts LF as line breaks and the TEXTDATA is as liberal as Jsonnet can be.
Tested with test suite from [max-mapper/csv-spectrum](https://github.com/max-mapper/csv-spectrum) and [sineemore/csv-test-data](https://github.com/sineemore/csv-test-data), passing a total of 29 test cases.
## Usage
```jsonnet
local parser = import 'github.com/Duologic/csv-libsonnet/main.libsonnet';
local csv = importstr 'path/to/your.csv';
parser.parse(csv) // with headers, returns an object for each record
parser.parseRecords(csv) // without headers, returns an array for each record
```