Modify JSON files with functions. Briefly useful in 2013, archived 2025.
This plugin requires Grunt ~0.4.1
Install grunt-json-massager with npm:
npm install grunt-json-massager --save-devand enable the plugin in your Gruntfile with:
grunt.loadNpmTasks('grunt-json-massager');In your project's Gruntfile, add a section named json_massager to the data object passed into grunt.initConfig().
grunt.initConfig({
json_massager: {
your_target: {
files: {
'build/some.json': ['build/some.json']
},
modifier: function(obj) {
obj.password = passwordFromScope;
delete obj.REMOVE_ME;
return obj;
}
},
},
})A src-dest file mapping. dest may be equal to src for in-place edits.
The function that modifies and returns the parsed object. See above.
- 2013-09-19 v0.1.0 It does what it needs to do.
Copyright (c) 2013 Jon Ramsey
Licensed under the MIT license.