{"id":15639775,"url":"https://github.com/doowb/grunt-convert","last_synced_at":"2025-04-30T07:22:20.048Z","repository":{"id":9290596,"uuid":"11125522","full_name":"doowb/grunt-convert","owner":"doowb","description":"Grunt task to convert to or from JSON, YAML, XML, PLIST or CSV.","archived":false,"fork":false,"pushed_at":"2014-11-25T21:02:36.000Z","size":413,"stargazers_count":84,"open_issues_count":13,"forks_count":17,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-19T11:51:55.141Z","etag":null,"topics":[],"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/doowb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-02T13:34:35.000Z","updated_at":"2023-10-11T12:55:02.000Z","dependencies_parsed_at":"2022-09-26T17:21:29.938Z","dependency_job_id":null,"html_url":"https://github.com/doowb/grunt-convert","commit_stats":null,"previous_names":["assemble/grunt-convert"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgrunt-convert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgrunt-convert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgrunt-convert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgrunt-convert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doowb","download_url":"https://codeload.github.com/doowb/grunt-convert/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251658629,"owners_count":21622899,"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-03T11:27:15.937Z","updated_at":"2025-04-30T07:22:20.026Z","avatar_url":"https://github.com/doowb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grunt-convert [![NPM version](https://badge.fury.io/js/grunt-convert.png)](http://badge.fury.io/js/grunt-convert)   [![Build Status](https://travis-ci.org/assemble/grunt-convert.png)](https://travis-ci.org/assemble/grunt-convert) \n\n\u003e Convert between XML, JSON and YAML, from one format to another.\n\n## Getting Started\n_If you haven't used [grunt][] before, be sure to check out the [Getting Started][] guide._\n\nFrom the same directory as your project's [Gruntfile][Getting Started] and [package.json][], install this plugin with the following command:\n\n```bash\nnpm install grunt-convert --save-dev\n```\n\nOnce that's done, add this line to your project's Gruntfile:\n\n```js\ngrunt.loadNpmTasks('grunt-convert');\n```\n\nIf the plugin has been installed correctly, running `grunt --help` at the command line should list the newly-installed plugin's task or tasks. In addition, the plugin should be listed in package.json as a `devDependency`, which ensures that it will be installed whenever the `npm install` command is run.\n\n[grunt]: http://gruntjs.com/\n[Getting Started]: https://github.com/gruntjs/grunt/blob/devel/docs/getting_started.md\n[package.json]: https://npmjs.org/doc/json.html\n\n## Options\n\n###### type\nType: `String`  \nDefault: `undefined`\n\nDefine content when using unknown extension.\n\n##### indent\nType: `Int`  \nDefault: `2`\n\nForce indentation (\"pretty printing\") for JSON and YAML.\n\n##### inline\nType: `Int`  \nDefault: `8`\n\nForce indentation (\"pretty printing\")  for YAML only.\n\n##### header\nType: `boolean`  \nDefault: false\n\nUse when converting JSON/YAML to XML. Add XML tag header.\n\nSee [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js#options) for other available options\n\n##### cvs.delimiter\nType: `string`  \nDefault: `,`\n\nSet the field delimiter. One character only.\n\n##### cvs.columns\nType: `boolean`  \nDefault: true\n\nList of fields or true if autodiscovered in the first CSV line.\n\nSee [node-csv](https://github.com/wdavidw/node-csv/blob/master/doc/from.md#from.options) for other available options.\n\n## Usage Examples\n\n\n### Convert CSV to JSON\n\n```js\ngrunt.initConfig({\n  convert: {\n    options: {\n      explicitArray: false,\n    },\n    csv2json: {\n      src: ['test/fixtures/csv2json.csv'],\n      dest: 'tmp/result/csv2json.json'\n    }\n  }\n});\n```\n\n\n### Convert JSON to XML\n\n```js\ngrunt.initConfig({\n  convert: {\n    options: {\n      explicitArray: false,\n    },\n    json2xml: {\n\t    options: {\n\t\t    xml: {\n\t\t      header: true\n\t\t    }\n\t\t  },\n      src: ['test/fixtures/sublime.json'],\n  \t\tdest: 'tmp/result/sublime.xml'\n    }\n  }\n});\n```\n\n\n### Convert JSON to YAML\n\n```js\ngrunt.initConfig({\n  convert: {\n    json2yml: {\n      files: [\n        {\n          expand: true,\n          cwd: 'test/fixtures/',\n          src: ['**/*.json'],\n          dest: 'tmp/result/',\n          ext: '.yml'\n        }\n      ]\n    }\n  }\n});\n```\n\n### Convert XML to YAML\n\n```js\ngrunt.initConfig({\n  convert: {\n    options: {\n      explicitArray: false,\n    },\n    xml2yml: {\n      src: ['convert.xml'],\n      dest: 'dist/convert.yml'\n    }\n  }\n});\n```\n\n### Convert XML to JSON\n\n```js\ngrunt.initConfig({\n  convert: {\n    options: {\n      explicitArray: false,\n    },\n\txml2json: {\n\t\tfiles: [\n\t\t  {\n\t\t    expand: true,\n\t\t    cwd: 'test/fixtures/',\n\t\t    src: ['**/*.xml'],\n\t\t    dest: 'tmp/result/',\n\t\t    ext: '.json'\n\t\t  }\n\t\t]\n\t},\n  }\n});\n```\n\n### Convert PLIST to JSON\n\n```js\ngrunt.initConfig({\n  convert: {\n    plist2json: {\n      files: [\n        {\n          expand: true,\n          cwd: 'test/fixtures/',\n          src: ['**/*.plist'],\n          dest: 'tmp/result/',\n          ext: '.json'\n        }\n      ]\n    }\n  }\n});\n```\n\n### Convert JSON to PLIST\n\n```js\ngrunt.initConfig({\n  convert: {\n    json2plist: {\n      files: [\n        {\n          expand: true,\n          cwd: 'test/fixtures/',\n          src: ['**/*.json'],\n          dest: 'tmp/result/',\n          ext: '.plist'\n        }\n      ]\n      }\n  }\n});\n```\n\n\n## Contributing\n\nWe welcome all kinds of contributions! The most basic way to show your support is to star the project, and if you'd like to get involved please see the [Contributing to grunt-convert](http://assemble.io/contributing/) guide for information on contributing to this project.\n\n## Changes\n**DATE**       **VERSION**   **CHANGES**                                                               \n* 2014-05-03   v0.1.11       Fix (empty string), xml2js (only invoke parseString callback once),XML    \n                             parser error display a warning and abort Grunt immediately                \n* 2014-03-11   v0.1.10       Fixing options.type issue and adding more tests around it                 \n* 2013-12-14   v0.1.9        Fix json to yml converter,Add `type` option to define content with unknown\n                             extension                                                                 \n* 2013-12-18   v0.1.8        adding missing write file statement when converting xml to json           \n* 2013-12-12   v0.1.7        Fix async issues                                                          \n* 2013-12-02   v0.1.6        Add support for Grunt 0.4.2,Use external library,Fix missing \"Release     \n                             History\"                                                                  \n* 2013-09-10   v0.1.5        Add support for JSON to CSV.                                              \n* 2013-09-10   v0.1.4        Add support for CSV to JSON.                                              \n* 2013-07-16   v0.1.3        JSON/YAML to XML.                                                         \n* 2013-07-15   v0.1.2        Add support YAML. Added XML to JSON/YAML, JSON to YAML, and YAML to JSON. \n* 2013-07-02   v0.1.1        XML to JSON.                                                              \n\n## Author\n\n**Jon Schlinkert**\n\n+ [github/jonschlinkert](https://github.com/jonschlinkert)\n+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)\n\n**Hariadi Hinta**\n\n+ [github.com/assemble](https://github.com/assemble)\n+ [twitter.com/assemble](http://twitter.com/assemble)\n\n## License\nCopyright (c) 2014 Jon Schlinkert, contributors.  \nReleased under the MIT license\n\n_This file was generated by [grunt-verb](https://github.com/assemble/grunt-verb) on August 15, 2014._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fgrunt-convert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoowb%2Fgrunt-convert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fgrunt-convert/lists"}