grunt-convert-json

Convert a file to a json file

grunt-convert-json

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.

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:

grunt.loadNpmTasks('grunt-convert-json');

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

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).

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.

0.1.0 First relase. 0.1.1 Options and tests.