{"id":17345025,"url":"https://github.com/jgranstrom/zipson","last_synced_at":"2025-05-16T06:04:37.159Z","repository":{"id":43512415,"uuid":"123956855","full_name":"jgranstrom/zipson","owner":"jgranstrom","description":"JSON parse and stringify with compression","archived":false,"fork":false,"pushed_at":"2024-03-03T16:53:55.000Z","size":803,"stargazers_count":495,"open_issues_count":14,"forks_count":16,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-09T19:18:23.181Z","etag":null,"topics":["compression","json","parse","stream","stringify"],"latest_commit_sha":null,"homepage":"https://jgranstrom.github.io/zipson/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jgranstrom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2018-03-05T17:51:38.000Z","updated_at":"2025-04-25T08:23:09.000Z","dependencies_parsed_at":"2024-06-18T15:22:56.209Z","dependency_job_id":"11c86cc7-7bc8-410c-8328-314676adc4aa","html_url":"https://github.com/jgranstrom/zipson","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgranstrom%2Fzipson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgranstrom%2Fzipson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgranstrom%2Fzipson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgranstrom%2Fzipson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jgranstrom","download_url":"https://codeload.github.com/jgranstrom/zipson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254478186,"owners_count":22077675,"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":["compression","json","parse","stream","stringify"],"created_at":"2024-10-15T16:28:38.693Z","updated_at":"2025-05-16T06:04:37.139Z","avatar_url":"https://github.com/jgranstrom.png","language":"TypeScript","readme":"# \u003cspan\u003e\u003cimg src=\"https://cdn.rawgit.com/jgranstrom/zipson/master/docs/icon.svg\" width=\"30\" height=\"30\"\u003e\u0026nbsp;zipson\u003c/span\u003e\n\n![CI status](https://github.com/jgranstrom/zipson/workflows/CI/badge.svg)\n[![npm version](https://badge.fury.io/js/zipson.svg)](http://badge.fury.io/js/zipson)\n\nZipson is a drop-in alternative to JSON.parse/stringify with added compression and streaming support.\n\n![demo](/docs/demo.gif?raw=true)\n\nTry the [online demo](https://jgranstrom.github.io/zipson/)\n\n---\n\n- [ zipson](#zipson)\n    - [Installing](#installing)\n    - [API](#api)\n        - [`stringify(data, options?)`](#stringifydata-options)\n        - [`stringifyTo(data, writer, options?)`](#stringifytodata-writer-options)\n        - [`parse(string)`](#parsestring)\n        - [`parseIncremental()`](#parseincremental)\n    - [Options](#options)\n        - [`detectUtcTimestamps`](#detectutctimestamps)\n        - [`fullPrecisionFloats`](#fullprecisionfloats)\n    - [Writer](#writer)\n    - [Features](#features)\n    - [Running the tests](#running-the-tests)\n    - [Contributing](#contributing)\n    - [Versioning](#versioning)\n    - [License](#license)\n\n### Installing\n\nAs an npm module\n\n`npm install --save zipson`\n\nOr alternatively from `jsdelivr` with a script tag as a UMD bundle\n\n`\u003cscript src=\"https://cdn.jsdelivr.net/npm/zipson@latest/dist/zipson.min.js\"\u003e\u003c/script\u003e`\n\n### API\n\n##### `stringify(data, options?)`\n\nStringify data to a zipson string\n\n```javascript\nimport { stringify } from 'zipson';\n\nconst myData = [1, 2, 3, 4 ,5];\nconst stringified = stringify(myData, options);\n```\n\n##### `stringifyTo(data, writer, options?)`\n\nStringify data to a specific zipson writer\n\n```javascript\nimport { stringifyTo, ZipsonStringWriter } from 'zipson';\n\nconst writer = new ZipsonStringWriter();\nconst myData = [1, 2, 3, 4, 5];\nstringifyTo(myData, writer, options);\nconst stringified = writer.value;\n```\n\n##### `parse(string)`\n\nParse a zipson string\n\n```javascript\nimport { parse } from 'zipson';\n\nconst myStringifiedData = '.......';\nconst parsed = parse(myStringifiedData);\n```\n\n##### `parseIncremental()`\n\nIncrementally parse a zipson string. Call the returned function once for each chunk of the string, calling it with null will signal end of string and returned the parsed result.\n\n```javascript\nimport { parseIncremental } from 'zipson';\n\nconst increment = parseIncremental();\nincrement(chunkOfStringifiedData1);\nincrement(chunkOfStringifiedData2);\nincrement(chunkOfStringifiedData3);\nincrement(chunkOfStringifiedData4);\nconst parsed = increment(null);\n```\n\n### Options\n\nCompression options can be provided to the stringify functions. Parse however does not take any options since it is not dependent on knowing with what options the string was compressed.\n\n##### `detectUtcTimestamps`\n\nSet to true to tell zipson to detect timestamps within strings such as `'2018-01-01T00:00:00Z'` in order to represent them more efficiently.\n\n##### `fullPrecisionFloats`\n\nBy default floating point precision is reduced to `10^-3`, set this to true in order to retain full floating point precision.\n\n### Writer\n\nCompression output is generalized to a writer class in order to support different output targets. Custom writers have to implement the following API.\n\n```typescript\nabstract class ZipsonWriter {\n\n  // Write a chunk of data\n  abstract write(data: string): void;\n\n  // End of writes\n  abstract end(): void;\n}\n```\n\n### Features\n* Efficient compression with a convenient API\n* Zero configuration drop-in replacement for JSON.stringify and JSON.parse\n* Zero dependencies\n* Detection of recurring patterns in recursive structures\n* Automatic reduction of floating point precision unless you actually need those fine 10^-xx decimals\n* Optional detection and compression of UTC timestamps in strings\n* Stream support with the companion lib [zipson-stream](https://github.com/jgranstrom/zipson-stream)\n* Support for browser and node\n\n### Running the tests\n\n```npm test```\n\nFor running tests in watch mode while developing:\n\n```npm run testw```\n\n### Contributing\n\nPull requests are welcome. Please see the [conventional commits](https://conventionalcommits.org/) guidelines for commit message formatting.\n\n### Versioning\n\nThis project is versioned using [SemVer](http://semver.org/) See [tags](https://github.com/jgranstrom/zipson/tags) and [CHANGELOG.md](CHANGELOG.md) for version details.\n\n### License\n\nThis project is licensed under the MIT License - see [LICENSE.md](LICENSE.md) file for details\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgranstrom%2Fzipson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjgranstrom%2Fzipson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgranstrom%2Fzipson/lists"}