{"id":23581266,"url":"https://github.com/pichsenmeister/json-transients","last_synced_at":"2026-04-19T04:34:18.290Z","repository":{"id":39407982,"uuid":"262921342","full_name":"pichsenmeister/json-transients","owner":"pichsenmeister","description":"A simple and minimalist wrapper library to deal with JavaScript object to JSON transformations that supports removing transient fields.","archived":false,"fork":false,"pushed_at":"2023-03-04T17:24:30.000Z","size":2471,"stargazers_count":2,"open_issues_count":16,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-27T12:16:36.343Z","etag":null,"topics":["json","json-data","json-parser","json-schema","jsontool"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/pichsenmeister.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":"2020-05-11T02:41:06.000Z","updated_at":"2022-03-28T17:25:16.000Z","dependencies_parsed_at":"2024-11-14T16:42:18.299Z","dependency_job_id":"832602a5-46d9-4442-afee-5d64ff9b914e","html_url":"https://github.com/pichsenmeister/json-transients","commit_stats":{"total_commits":11,"total_committers":3,"mean_commits":"3.6666666666666665","dds":0.6363636363636364,"last_synced_commit":"40330ecfaab7d9a3ab793b625752ad921d27bff7"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pichsenmeister%2Fjson-transients","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pichsenmeister%2Fjson-transients/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pichsenmeister%2Fjson-transients/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pichsenmeister%2Fjson-transients/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pichsenmeister","download_url":"https://codeload.github.com/pichsenmeister/json-transients/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239394626,"owners_count":19631122,"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":["json","json-data","json-parser","json-schema","jsontool"],"created_at":"2024-12-27T00:15:16.185Z","updated_at":"2025-11-02T13:30:38.571Z","avatar_url":"https://github.com/pichsenmeister.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json-transients\n\n\u003ca href=\"https://www.npmjs.com/package/json-transients\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/json-transients.svg\" alt=\"npm version\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://david-dm.org/pichsenmeister/json-transients\"\u003e\n    \u003cimg src=\"https://david-dm.org/pichsenmeister/json-transients.svg\" alt=\"Dependency Status\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://david-dm.org/pichsenmeister/json-transients#info=devDependencies\"\u003e\n    \u003cimg src=\"https://david-dm.org/pichsenmeister/json-transients/dev-status.svg\" alt=\"devDependency Status\" /\u003e\n\u003c/a\u003e\n\nA simple and minimalist wrapper library to deal with JavaScript object to JSON transformations that supports removing transient fields.\n\n* [Installation](#installation)\n* [Getting started](#getting-started)\n* [License](#license)\n\n## Installation\n\nInstall via npm\n\n```\nnpm install json-transients\n```\n\nor yarn\n\n```\nyarn add json-transients\n```\n\n## Getting started\n\nLet's take a very simple JSON object as example ...\n```\nconst json = {\n    $_transient: '',\n    isUndefined: undefined,\n    str: \"string\",\n    number: 1,\n    bool: true,\n    fn: () =\u003e { }\n}\n```\n\n... and transform it to remove transient fiels (properties prefixed with `$_` in this example)\n```\nconst JsonTransients = require('json-transients')\n\nconst jst = new JsonTransients()\nconst result = jst.transform(json)\n```\n\nThis will remove all transient fields and return a valid JSON object:\n\n```\n{\n    isUndefined: null,\n    str: \"string\",\n    number: 1,\n    bool: true\n}\n```\n\n## Config\n\nEach instance of `JsonTransients` takes a configuration object with following properties:\n\n| Property | Required | Default | Description |\n| ---- | ---- | ---- | ---- |\n| `prefix` | no | `$_` | Prefix for transients fields that are being removed |\n| `transformUndefined` | no | `true` | Sets all `undefined` properties to `null`. If set to `false` all `undefined` properties will be removed. You can also define a custom handler. |\n| `transformDate` | no | `toISOString()` | Define a custom handler to transfrom `Date` objects. Sets all date properties to ISO string by default. |\n\n### Example\n```\nconst jst = new JsonTransients({\n    // use a custom prefix\n    prefix: 'CUSTOM_`,\n    // transform all undefined properties to \"not_defined\" string\n    transformUndefined: () =\u003e { \n        return 'not_defined'\n    },\n    // transform all dates to timestamp\n    transformDate: (value) =\u003e { \n        return value.getTime()\n    }\n})\n```\n\n## License\n\nThis project is licensed under the MIT license, Copyright (c) 2020 David Pichsenmeister | [pichsenmeister.com](https://pichsenmeister.com). For more information see [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpichsenmeister%2Fjson-transients","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpichsenmeister%2Fjson-transients","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpichsenmeister%2Fjson-transients/lists"}