Skip to content

Commit

Permalink
Adding JSONL support to json extractor (#705)
Browse files Browse the repository at this point in the history
* Add jsonl support into json extractor plugin

* Add test case

* Fix lint errors

* Add changeset

* Apply CodeRabbit suggestion

---------

Co-authored-by: Gabor Cseh <[email protected]>
Co-authored-by: Carl Brugger <[email protected]>
  • Loading branch information
3 people authored Nov 22, 2024
1 parent c4be770 commit 7ef4cd3
Show file tree
Hide file tree
Showing 7 changed files with 218 additions and 164 deletions.
6 changes: 6 additions & 0 deletions .changeset/tender-lizards-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@flatfile/plugin-json-extractor': minor
'@flatfile/util-extractor': minor
---

This release adds support for JSONL files in the JSON Extractor plugin.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions plugins/json-extractor/ref/test-basic.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{"First Name": "Tony","Last Name": "Lamb","Email": "[email protected]","Address": {"Street": "123 Main Street","City": "Springfield","State": "ST","Zip": "12345","Coordinates": {"Latitude": "40.7128° N","Longitude": "74.0060° W"}},"Father": {"First Name": "Father_First_1","Last Name": "Father_Last_1","Father": {"First Name": "Father_First_2","Last Name": "Father_Last_2","Father": {"First Name": "Father_First_3","Last Name": "Father_Last_3","Father": {"First Name": "Father_First_4","Last Name": "Father_Last_4","Father": {"First Name": "Father_First_5","Last Name": "Father_Last_5","Father": null}}}}}}
{"First Name": "Christian","Last Name": "Ramos","Email": "[email protected]","Address": {"Street": "456 Elm Street","City": "Greenville","State": "GT","Zip": "67890","Coordinates": {"Latitude": "40.7128° N","Longitude": "74.0060° W"}},"Father": {"First Name": "Father_First_1","Last Name": "Father_Last_1","Father": {"First Name": "Father_First_2","Last Name": "Father_Last_2","Father": {"First Name": "Father_First_3","Last Name": "Father_Last_3","Father": {"First Name": "Father_First_4","Last Name": "Father_Last_4","Father": {"First Name": "Father_First_5","Last Name": "Father_Last_5","Father": null}}}}}}
{"First Name": "Frederick","Last Name": "Boyd","Email": "[email protected]","Address": {"Street": "789 Oak Street","City": "Rivertown","State": "RT","Zip": "10112","Coordinates": {"Latitude": "40.7128° N","Longitude": "74.0060° W"}},"Father": {"First Name": "Father_First_1","Last Name": "Father_Last_1","Father": {"First Name": "Father_First_2","Last Name": "Father_Last_2","Father": {"First Name": "Father_First_3","Last Name": "Father_Last_3","Father": {"First Name": "Father_First_4","Last Name": "Father_Last_4","Father": {"First Name": "Father_First_5","Last Name": "Father_Last_5","Father": null}}}}}}
2 changes: 1 addition & 1 deletion plugins/json-extractor/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface PluginOptions {
}

export const JSONExtractor = (options?: PluginOptions) => {
return Extractor('.json', 'json', parseBuffer, options)
return Extractor(/\.(jsonl?|jsonlines)$/i, 'json', parseBuffer, options)
}

export const jsonParser = parseBuffer
Expand Down
Loading

0 comments on commit 7ef4cd3

Please sign in to comment.