This package has been deprecated

Author message:

This package is no longer maintained. Please look for alternatives or bring it in to your project and maintain it yourself.

grunt-json-format

2.0.1 • Public • Published

grunt-json-format

A Grunt Task for formatting JSON files.

Build Status NPM Release

Getting Started

# Add the module to your project 
npm install grunt-json-format --save-dev
// Load the module in your Gruntfile
grunt.loadNpmTasks('grunt-json-format');

Of course, you'll need to be using Grunt

Usage

// Configure the task by providing a config.
'json-format': {
    test: {
        options: {
            indent: 4,
            remove: ['_comment']
        },
        files: [
            {
                expand: true,
                cwd: './test',
                src:  ['./json/test-1-*.json'],
                dest: './build/'
            },
            {
                expand: true,
                cwd: './test',
                src:  ['./json/test-2-*.json'],
                dest: './build/'
            }
        ]
    }
}
# Run the task 
grunt json-format:test

Options

indent

Type: String or Number

Default: null

The indentation of the output.

Number indicated the number of whitespaces to use whereas a String will indicate the character to use (for example \t will use tab characters).

By providing null or 0, no indentation will be used and the output will essentially be minified.

remove

Type: Array

Default: []

The keys to remove from the output.

This is useful for removing comment keys like _comment.

Files

Check the Grunt Documentation on how to declare files and how Grunt parses them.

License

Copyright (c) 2014 Jahed Ahmed

Licensed under the MIT license.

Package Sidebar

Install

npm i grunt-json-format

Weekly Downloads

100

Version

2.0.1

License

MIT

Last publish

Collaborators

  • jahed