Fixed sort order of numeric fields

This commit is contained in:
Rashid Khan
2013-04-01 16:52:18 -07:00
parent 86254db78c
commit 9ed8265c1e
5 changed files with 14 additions and 5 deletions
+8 -3
View File
@@ -270,10 +270,15 @@ function flatten_json(object,root,array) {
var obj = object[index]
var rootname = root.length == 0 ? index : root + '.' + index;
if(typeof obj == 'object' ) {
if(_.isArray(obj))
array[rootname] = typeof obj === 'undefined' ? null : obj.join(',');
else
if(_.isArray(obj)) {
if(obj.length === 1 && _.isNumber(obj[0])) {
array[rootname] = parseFloat(obj[0]);
} else {
array[rootname] = typeof obj === 'undefined' ? null : obj.join(',');
}
} else {
flatten_json(obj,rootname,array)
}
} else {
array[rootname] = typeof obj === 'undefined' ? null : obj;
}