{"id":30420294,"url":"https://github.com/rictic/jsonriver","last_synced_at":"2025-08-22T08:18:04.651Z","repository":{"id":293887754,"uuid":"870911441","full_name":"rictic/jsonriver","owner":"rictic","description":"A simple, fast streaming JSON parser built on standards.","archived":false,"fork":false,"pushed_at":"2025-07-30T20:41:34.000Z","size":4512,"stargazers_count":24,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-30T22:57:31.046Z","etag":null,"topics":["incremental-parsing","json","parsing","streaming","streaming-parser"],"latest_commit_sha":null,"homepage":"https://rictic.github.io/jsonriver/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rictic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-10-10T22:32:10.000Z","updated_at":"2025-07-30T20:40:44.000Z","dependencies_parsed_at":"2025-05-17T19:24:08.021Z","dependency_job_id":"2faa7689-6997-4540-a5ca-a1ef445a51ed","html_url":"https://github.com/rictic/jsonriver","commit_stats":null,"previous_names":["rictic/jsonriver"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rictic/jsonriver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rictic%2Fjsonriver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rictic%2Fjsonriver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rictic%2Fjsonriver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rictic%2Fjsonriver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rictic","download_url":"https://codeload.github.com/rictic/jsonriver/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rictic%2Fjsonriver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271606605,"owners_count":24788981,"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","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["incremental-parsing","json","parsing","streaming","streaming-parser"],"created_at":"2025-08-22T08:18:03.610Z","updated_at":"2025-08-22T08:18:04.644Z","avatar_url":"https://github.com/rictic.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# jsonriver\n\nParse JSON incrementally as it streams in, e.g. from a network request or a language model. Gives you a sequence of increasingly complete values.\n\njsonriver is small, fast, has no dependencies, and uses only standard features of JavaScript so it works in any JS environment.\n\nUsage:\n\n```js\n// Richer example at examples/fetch.js\nimport {parse} from 'jsonriver';\n\nconst response = await fetch(`https://jsonplaceholder.typicode.com/posts`);\nconst postsStream = parse(response.body.pipeThrough(new TextDecoderStream()));\nfor await (const posts of postsStream) {\n  console.log(posts);\n}\n```\n\n## Incremental Values\n\nWhat does it mean that we give you a sequence of increasingly complete values? Consider this JSON:\n\n```json\n{\"name\": \"Alex\", \"keys\": [1, 20, 300]}\n```\n\nIf you gave this to jsonriver one byte at a time it would yield this sequence of values:\n\n```json\n{}\n{\"name\": \"\"}\n{\"name\": \"A\"}\n{\"name\": \"Al\"}\n{\"name\": \"Ale\"}\n{\"name\": \"Alex\"}\n{\"name\": \"Alex\", \"keys\": []}\n{\"name\": \"Alex\", \"keys\": [1]}\n{\"name\": \"Alex\", \"keys\": [1, 20]}\n{\"name\": \"Alex\", \"keys\": [1, 20, 300]}\n```\n\n## Correctness\n\nThe final value yielded by `parse` will be the same as if you had called `JSON.parse` on the entire string. This is tested against the JSONTestSuite, matching JSON.parse's behavior on tests of correct, incorrect, and ambiguous cases.\n\n## Invariants\n\n1.  Subsequent versions of a value will have the same type. i.e. we will never\n    yield a value as a string and then later replace it with an array.\n2.  true, false, null, and numbers are atomic, we don't yield them until\n    we have the entire value.\n3.  Strings may be replaced with a longer string, with more characters (in\n    the JavaScript sense) appended.\n4.  Arrays are only modified by either appending new elements, or\n    replacing/mutating the element currently at the end.\n5.  Objects are only modified by either adding new properties, or\n    replacing/mutating the most recently added property.\n6.  As a consequence of 1 and 5, we only add a property to an object once we\n    have the entire key and enough of the value to know that value's type.\n\n## See also\n\nThe built-in JSON.parse is faster (~5x in simple benchmarking) if you don't need streaming.\n\n[stream-json](https://www.npmjs.com/package/stream-json), is larger, more complex, and slower (~10-20x slower in simple benchmarking), but it's much more featureful, and if you only need a subset of the data it can likely be much faster.\n\n## Development\n\nInstall dependencies with:\n\n```bash\nnpm ci\n```\n\nRun the test suite with:\n\n```bash\nnpm test\n```\n\nRun the linter with:\n\n```bash\nnpm run lint\n```\n\nAnd auto-fix most lint issues with:\n\n```bash\nnpm run lint -- --fix\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frictic%2Fjsonriver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frictic%2Fjsonriver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frictic%2Fjsonriver/lists"}