
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
gulp-json-sort
Advanced tools
Gulp plugin for deterministic sorting of JSON files. Supports deep structures, custom compare functions, replacers, and formatting options.
Thin wrapper over substack's json-stable-stringify, which does all the hard work.
This plugin is authored in ES6, so until Node picks up ES6 module support you'll need to pluck the default property from the require'd import.
var gulp = require('gulp');
var sortJSON = require('gulp-json-sort').default;
gulp.task('sort-json', function() {
return gulp.src('./**/*.json')
.pipe(sortJSON({ space: 2 }))
.pipe(gulp.dest('./'));
});
By default (with no compare function provided), sorting happens alphabetically by key.
If a file contains invalid JSON, a parse error will be emitted on the stream.
Newlines in the output are always LF. Pipe the results through gulp-eol as needed.
sortJSON(options?: {
cmp?: (left: { key: string, value: any }, right: { key: string, value: any }) => number,
cycles?: boolean,
replacer?: (key: string, value: any) => any,
space?: number | string
});
See json-stable-stringify for details and behavior for each option; the params are passed straight through.
MIT License (Expat)
FAQs
Gulp plugin for deterministic sorting of JSON files
The npm package gulp-json-sort receives a total of 1,213 weekly downloads. As such, gulp-json-sort popularity was classified as popular.
We found that gulp-json-sort demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.