Created
February 16, 2026 19:30
-
-
Save fauxsaurus/a1b454db4c30e3fbc095b05d1afe70ea to your computer and use it in GitHub Desktop.
Quickly convert TSV strings to JSON (note: does NOT support escaped tabs).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const tsv2json = (tsv: string) => { | |
| const [cols, ...rows] = tsv.split('\n').map(line => line.split('\t')) | |
| return rows.map(row => | |
| Object.fromEntries(row.map((cell, i) => [cols[i], cell])), | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment