Created
August 15, 2016 02:41
-
-
Save kidchenko/07e3301b07c73444ada9990764bdd43c to your computer and use it in GitHub Desktop.
A small snippet to order a json file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _ = require('underscore'); | |
var fs = require('fs'); | |
var menu = JSON.parse(fs.readFileSync('file.json', 'utf8')); | |
menu = _.sortBy(menu, 'nome'); | |
menu = JSON.stringify(menu, null, 4); | |
fs.writeFile("menu.json", menu); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment