{"id":15655440,"url":"https://github.com/linusu/node-jsonlines","last_synced_at":"2025-07-20T17:32:24.853Z","repository":{"id":36199393,"uuid":"40503618","full_name":"LinusU/node-jsonlines","owner":"LinusU","description":"Parse JSONLines with Node.js.","archived":false,"fork":false,"pushed_at":"2019-11-24T17:50:52.000Z","size":6,"stargazers_count":24,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-01T11:51:52.637Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LinusU.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-10T20:07:48.000Z","updated_at":"2024-05-13T15:42:52.000Z","dependencies_parsed_at":"2022-08-18T18:21:44.393Z","dependency_job_id":null,"html_url":"https://github.com/LinusU/node-jsonlines","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/LinusU/node-jsonlines","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Fnode-jsonlines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Fnode-jsonlines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Fnode-jsonlines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Fnode-jsonlines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LinusU","download_url":"https://codeload.github.com/LinusU/node-jsonlines/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Fnode-jsonlines/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266165569,"owners_count":23886639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T12:59:14.259Z","updated_at":"2025-07-20T17:32:24.818Z","avatar_url":"https://github.com/LinusU.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSONLines for Node.js\n\nParse [JSONLines](http://jsonlines.org) with Node.js.\n\n## Installation\n\n```sh\nnpm install --save jsonlines\n```\n\n## Usage\n\n```javascript\nvar jsonlines = require('jsonlines')\nvar parser = jsonlines.parse()\n\nparser.on('data', function (data) {\n  console.log('Got json:', data)\n})\n\nparser.on('end', function () {\n  console.log('No more data')\n})\n\nparser.write('{ \"test\": \"This is a test!\" }\\n')\nparser.write('{ \"jsonlines\": \"is awesome\" }')\nparser.end()\n```\n\n```javascript\nvar jsonlines = require('jsonlines')\nvar stringifier = jsonlines.stringify()\n\nstringifier.pipe(process.stdout)\n\nstringifier.write({ test: 'This is a test!' })\nstringifier.write({ jsonlines: 'is awesome' })\nstringifier.end()\n```\n\n## API\n\n### `.parse([options])`\n\nReturns a transform stream that turns newline separated json into a stream of\njavascript values.\n\n`options` is an optional object with the keys documented below.\n\n### `.stringify()`\n\nReturns a transform stream that turns javascript values into a stream of newline\nseparated json.\n\n## Options\n\n### `emitInvalidLine`\n\nIf true, instead of emitting an error and cancelling the stream when an invalid line is proccessed, an `invalid-line` event is emitted with the same error. This is very useful when processing text that have mixed plain text and json data.\n\nExample:\n\n```js\nvar jsonlines = require('jsonlines')\nvar parser = jsonlines.parse({ emitInvalidLines: true })\n\nparser.on('data', function (data) {\n  console.log('Got json:', data)\n})\n\nparser.on('invalid-line', function (err) {\n  console.log('Got text:', err.source)\n})\n\nparser.write('{ \"test\": \"This is a test!\" }\\n')\nparser.write('This is some plain text\\n')\nparser.write('{ \"jsonlines\": \"is awesome\" }')\nparser.end()\n```\n\nOutput:\n\n```text\nGot json: { test: 'This is a test!' }\nGot text: This is some plain text\nGot json: { jsonlines: 'is awesome' }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinusu%2Fnode-jsonlines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinusu%2Fnode-jsonlines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinusu%2Fnode-jsonlines/lists"}