node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »



Convert a text file to a json file reading lines and splitting them on delimiter. Useful for create config file from a simple text source.

Getting Started

This plugin requires Grunt ~0.4.1

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-convert-json --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:


The "convert_json" task


In your project's Gruntfile, add a section named convert_json to the data object passed into grunt.initConfig().

  convert_json: {
    options: {
      // Task-specific options go here. 
    your_target: {
      // Target-specific file lists and/or options go here. 



Type: Int Default value: '2'

Spaces for JSON converter.


Type: Int Default value: '|'

The token used to split lines in key/values pairs.


Type: Boolean Default value: false

On true minify JSON output.


Type: Boolean Default value: false

On true will output only keys (values are blank for txt and empty strings for .json).

Usage Examples

see Gruntfile.js for examples, look also at test/convert_json_test.js.


In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

0.1.0 First relase. 0.1.1 Options and tests.