{"id":47994720,"url":"https://github.com/remarkablemark/decycle","last_synced_at":"2026-04-04T11:53:08.938Z","repository":{"id":337146113,"uuid":"1152497120","full_name":"remarkablemark/decycle","owner":"remarkablemark","description":"🗂️ JSON decycle replaces circular references with JSONPath","archived":false,"fork":false,"pushed_at":"2026-04-03T18:27:24.000Z","size":196,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-03T20:56:56.932Z","etag":null,"topics":["circular-reference","circular-references","cycle","javascript","json","jsonpath","library","npm","npm-package","package","typescript"],"latest_commit_sha":null,"homepage":"http://remarkablemark.org/decycle/","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/remarkablemark.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null},"funding":{"github":["remarkablemark"],"patreon":"remarkablemark","open_collective":null,"ko_fi":"remarkablemark","tidelift":null,"community_bridge":null,"liberapay":"remarkablemark","issuehunt":null,"otechie":null,"buy_me_a_coffee":"remarkablemark","thanks_dev":"u/gh/remarkablemark","custom":["https://b.remarkabl.org/teespring"]}},"created_at":"2026-02-08T00:39:36.000Z","updated_at":"2026-04-03T18:27:00.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/remarkablemark/decycle","commit_stats":null,"previous_names":["remarkablemark/decycle"],"tags_count":1,"template":false,"template_full_name":"remarkablemark/npm-package-typescript-template","purl":"pkg:github/remarkablemark/decycle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkablemark%2Fdecycle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkablemark%2Fdecycle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkablemark%2Fdecycle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkablemark%2Fdecycle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remarkablemark","download_url":"https://codeload.github.com/remarkablemark/decycle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkablemark%2Fdecycle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31398770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["circular-reference","circular-references","cycle","javascript","json","jsonpath","library","npm","npm-package","package","typescript"],"created_at":"2026-04-04T11:53:08.869Z","updated_at":"2026-04-04T11:53:08.930Z","avatar_url":"https://github.com/remarkablemark.png","language":"TypeScript","readme":"# decycle\n\n[![NPM](https://nodei.co/npm/decycle.svg)](https://www.npmjs.com/package/decycle)\n\n[![NPM version](https://img.shields.io/npm/v/decycle.svg)](https://www.npmjs.com/package/decycle)\n[![build](https://github.com/remarkablemark/decycle/actions/workflows/build.yml/badge.svg)](https://github.com/remarkablemark/decycle/actions/workflows/build.yml)\n[![codecov](https://codecov.io/gh/remarkablemark/decycle/graph/badge.svg?token=XCMG4hmYbs)](https://codecov.io/gh/remarkablemark/decycle)\n\nJSON decycle replaces circular references with `{\"$ref\": PATH}`, where PATH is the [JSONPath](https://wikipedia.org/wiki/JSONPath) of the first occurrence.\n\nInspired by [cycle.js](https://github.com/douglascrockford/JSON-js/blob/master/cycle.js).\n\n## Quick Start\n\n```ts\nimport { decycle } from 'decycle';\n\nconst obj = { a: 1 };\nobj.self = obj;\n\nJSON.stringify(decycle(obj));\n// '{\"a\":1,\"self\":{\"$ref\":\"$\"}}'\n```\n\n## Install\n\n[NPM](https://www.npmjs.com/package/decycle):\n\n```sh\nnpm install decycle\n```\n\n[Yarn](https://yarnpkg.com/package/decycle):\n\n```sh\nyarn add decycle\n```\n\n[CDN](https://unpkg.com/browse/decycle/):\n\n```html\n\u003cscript src=\"https://unpkg.com/decycle@latest/dist/index.umd.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\nES Modules:\n\n```ts\nimport { decycle } from 'decycle';\n```\n\nCommonJS:\n\n```ts\nconst { decycle } = require('decycle');\n```\n\nUMD:\n\n```html\n\u003cscript src=\"https://unpkg.com/decycle@latest/dist/index.umd.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  const { decycle } = window.decycle;\n\u003c/script\u003e\n```\n\n### decycle(value, replacer?)\n\nReturns a deep copy of `object` or `array` with circular references replaced by `{\"$ref\": PATH}`.\n\n#### value\n\nType: `unknown`\n\nThe object or array to decycle.\n\n#### replacer\n\nType: `(value: unknown) =\u003e unknown`\n\nOptional replacer function called for each value. It receives a value and returns a replacement value.\n\n### Examples\n\nCircular array:\n\n```ts\nconst array = [];\narray[0] = array;\nJSON.stringify(decycle(array)); // '[{\"$ref\":\"$\"}]'\n```\n\nWith replacer:\n\n```ts\nconst obj = { date: new Date('2026-02-07') };\nconst result = decycle(obj, (value) =\u003e\n  value instanceof Date ? value.toISOString() : value,\n);\n// { date: '2026-02-07T00:00:00.000Z' }\n```\n\n## Release\n\nRelease is automated with [Release Please](https://github.com/googleapis/release-please).\n\n## License\n\n[MIT](https://github.com/remarkablemark/decycle/blob/master/LICENSE)\n","funding_links":["https://github.com/sponsors/remarkablemark","https://patreon.com/remarkablemark","https://ko-fi.com/remarkablemark","https://liberapay.com/remarkablemark","https://buymeacoffee.com/remarkablemark","https://thanks.dev/u/gh/remarkablemark","https://b.remarkabl.org/teespring"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremarkablemark%2Fdecycle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremarkablemark%2Fdecycle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremarkablemark%2Fdecycle/lists"}