{"id":15382165,"url":"https://github.com/stefnotch/json-safe-stringify","last_synced_at":"2025-04-15T19:29:01.404Z","repository":{"id":65311913,"uuid":"589488781","full_name":"stefnotch/json-safe-stringify","owner":"stefnotch","description":"Stringify a Javascript JSON object, and actually handle Maps and Sets","archived":false,"fork":false,"pushed_at":"2024-02-15T21:02:55.000Z","size":280,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T00:05:57.243Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/stefnotch.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}},"created_at":"2023-01-16T08:39:03.000Z","updated_at":"2024-11-26T09:53:58.000Z","dependencies_parsed_at":"2024-10-18T09:29:40.419Z","dependency_job_id":null,"html_url":"https://github.com/stefnotch/json-safe-stringify","commit_stats":{"total_commits":14,"total_committers":2,"mean_commits":7.0,"dds":0.3571428571428571,"last_synced_commit":"ba7d53156c3d4465ce3f08a424551d600646acbd"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":"stefnotch/npm-typescript-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefnotch%2Fjson-safe-stringify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefnotch%2Fjson-safe-stringify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefnotch%2Fjson-safe-stringify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefnotch%2Fjson-safe-stringify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stefnotch","download_url":"https://codeload.github.com/stefnotch/json-safe-stringify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249138001,"owners_count":21218814,"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-01T14:30:05.206Z","updated_at":"2025-04-15T19:29:01.382Z","avatar_url":"https://github.com/stefnotch.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json-safe-stringify\n\n[NPM Package](https://www.npmjs.com/package/json-safe-stringify)\n\nFixes the issues with https://stackoverflow.com/a/56150320/3492994 and other answers on that page.\n\nExample\n\n```ts\nconst serializer = new JsonSerializer();\nconst text = serializer.stringify({ map: new Map([[\"a\", 1]]) });\nconsole.log(text);\nconst obj = serializer.parse(text, (error) =\u003e console.error(error));\n```\n\nOr use it directly\n\n```ts\nconst text = JSON.stringify(\n  { map: new Map([[\"a\", 1]]) },\n  jsonStringifyReplacer\n);\nconsole.log(text);\nconst obj = JSON.parse(text, (key, value) =\u003e\n  jsonParseReviver(key, value, (error) =\u003e console.error(error))\n);\n```\n\n## FAQ\n\n- Typescript cannot find the library?\n  That's because this uses the [`\"export\"` field in the `package.json`](https://www.typescriptlang.org/docs/handbook/esm-node.html#packagejson-exports-imports-and-self-referencing). Go to your `tsconfig.json`, or create one if there is none, and set\n```json\n{\n    \"compilerOptions\": {\n        /* This tells Typescript that we're working with the new importing mechanisms */\n        \"module\": \"nodenext\", \n    }\n}\n```\nMake sure to read [the documentation](https://www.typescriptlang.org/docs/handbook/esm-node.html) for what that means, among other things all the imports in your code might need a file extension.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefnotch%2Fjson-safe-stringify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefnotch%2Fjson-safe-stringify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefnotch%2Fjson-safe-stringify/lists"}