json-ksort
v1.0.4
Published
json-ksort
Downloads
70
Readme
json-ksort
Quick sort JSON Data,Sorts an JSON by key
var ksort = require('json-ksort')
let data = {
b:'b',
a:'a',
q:'q',
g:'g',
c:'c',
d:'d',
ess:'e',
cc:[
'ss','dd','cc'
],
aa:{
d:'d',
e:'e',
b:'b',
a:'a',
q:'q',
g:'g',
c:'c',
}
};
console.log(ksort(data));
// Result
/**
{
"a":"a",
"aa":{
"a":"a",
"b":"b",
"c":"c",
"d":"d",
"e":"e",
"g":"g",
"q":"q"
},
"b":"b",
"c":"c",
"cc":{
"0":"ss",
"1":"dd",
"2":"cc"
},
"d":"d",
"ess":"e",
"g":"g",
"q":"q"
}
**/