{"id":28124480,"url":"https://github.com/gulp-community/gulp-json-editor","last_synced_at":"2025-05-14T09:18:25.876Z","repository":{"id":13847085,"uuid":"16544325","full_name":"gulp-community/gulp-json-editor","owner":"gulp-community","description":"A gulp plugin to edit JSON objects","archived":false,"fork":false,"pushed_at":"2025-02-18T08:06:31.000Z","size":891,"stargazers_count":61,"open_issues_count":1,"forks_count":12,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-12T16:19:17.279Z","etag":null,"topics":["gulp","gulp-plugin","json"],"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/gulp-community.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":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-02-05T12:37:52.000Z","updated_at":"2025-02-18T08:06:33.000Z","dependencies_parsed_at":"2024-06-18T13:43:41.350Z","dependency_job_id":null,"html_url":"https://github.com/gulp-community/gulp-json-editor","commit_stats":{"total_commits":117,"total_committers":13,"mean_commits":9.0,"dds":0.7264957264957265,"last_synced_commit":"a2538ae116a7a296d6a55718953c8ad9ce65457d"},"previous_names":["rejas/gulp-json-editor"],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulp-community%2Fgulp-json-editor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulp-community%2Fgulp-json-editor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulp-community%2Fgulp-json-editor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulp-community%2Fgulp-json-editor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gulp-community","download_url":"https://codeload.github.com/gulp-community/gulp-json-editor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254110432,"owners_count":22016392,"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":["gulp","gulp-plugin","json"],"created_at":"2025-05-14T09:18:13.048Z","updated_at":"2025-05-14T09:18:25.862Z","avatar_url":"https://github.com/gulp-community.png","language":"JavaScript","readme":"# gulp-json-editor\n\n[![npm version](https://badge.fury.io/js/gulp-json-editor.svg)](https://www.npmjs.com/package/gulp-json-editor)\n[![Automated tests](https://github.com/gulp-community/gulp-json-editor/actions/workflows/run-tests.yml/badge.svg)](https://github.com/gulp-community/gulp-json-editor/actions/workflows/run-tests.yml)\n\ngulp-json-editor is a [gulp](https://github.com/gulpjs/gulp) plugin to edit JSON objects.\n\n## Usage\n```javascript\nvar jeditor = require(\"gulp-json-editor\");\n\n/*\n  edit JSON object by merging with user specific object\n*/\ngulp.src(\"./manifest.json\")\n  .pipe(jeditor({\n    'version': '1.2.3'\n  }))\n  .pipe(gulp.dest(\"./dest\"));\n\n/*\n  edit JSON object by using user specific function\n*/\ngulp.src(\"./manifest.json\")\n  .pipe(jeditor(function(json) {\n    json.version = \"1.2.3\";\n    return json; // must return JSON object.\n  }))\n  .pipe(gulp.dest(\"./dest\"));\n\n/*\n  specify [js-beautify](https://github.com/beautify-web/js-beautify) option\n*/\ngulp.src(\"./manifest.json\")\n  .pipe(jeditor({\n    'version': '1.2.3'\n  },\n  // the second argument is passed to js-beautify as its option\n  {\n    'indent_char': '\\t',\n    'indent_size': 1\n  }))\n  .pipe(gulp.dest(\"./dest\"));\n\n/*\n  specify [deepmerge](https://github.com/TehShrike/deepmerge) option\n*/\ngulp.src(\"./manifest.json\")\n  .pipe(jeditor({ \n    \"authors\": [\"tomcat\"] \n  },\n  // the second argument is passed to js-beautify as its option\n  {},\n  // the third argument is passed to deepmerge options, eg, arrayMerge options\n  { \n    arrayMerge: function (dist,source,options) {return source;} \n  }))\n  .pipe(gulp.dest(\"./dest\"));\n```\n\n### Note\nIn case of such above situation, all of comment and whitespace in source file is **NOT** kept in destination file.\n\n### Disable beautification\n\n```javascript\ngulp.src(\"./manifest.json\")\n  .pipe(jeditor({\n    'version': '1.2.3'\n  },\n  {\n    beautify: false\n  }))\n  .pipe(gulp.dest(\"./dest\"));\n```\n\n\n## API\n### jeditor(editorObject, [jsBeautifyOptions], [deepmergeOptions])\n#### editorObject\nType: `JSON object`\n\nJSON object to merge with.\n\n#### jsBeautifyOptions\nType: `object`\n\nThis object is passed to js-beautify as its option.\n\n#### deepmergeOptions\nType: `object`\n\nThis object is passed to deepmerge as its [option](https://github.com/TehShrike/deepmerge#options).\n\n### jeditor(editorFunction, [jsBeautifyOptions], [deepmergeOptions])\n#### editorFunction\nType: `function`\n\nThe `editorFunction` must have the following signature: `function (json) {}`, and must return JSON object or PromiseLike object with JSON object as value.\n\n#### jsBeautifyOptions\nType: `object`\n\nThis object is passed to js-beautify as its option.\n\n#### deepmergeOptions\nType: `object`\n\nThis object is passed to deepmerge as its [option](https://github.com/TehShrike/deepmerge#options).\n\n## License\n\nCopyright (c) 2024 gulp-community\n\nLicensed under the [MIT license](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgulp-community%2Fgulp-json-editor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgulp-community%2Fgulp-json-editor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgulp-community%2Fgulp-json-editor/lists"}