Skip to content

Commit f13bd63

Browse files
committed
Updating json-2-csv for #5
1 parent 21647fe commit f13bd63

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/json-2-csv.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var retrieveSubHeading = function (heading, data) {
1212
_.each(subKeys, function (subKey, indx) {
1313
// If the given heading is empty, then we set the heading to be the subKey, otherwise set it as a nested heading w/ a dot
1414
newKey = heading === '' ? subKey : heading + '.' + subKey;
15-
if (typeof data[subKey] === 'object' && data[subKey] !== null && typeof data[subKey].length === 'undefined') { // If we have another nested document
15+
if (typeof data[subKey] === 'object' && data[subKey] !== null && typeof data[subKey].length === 'undefined' && _.keys(data[subKey]).length > 0) { // If we have another nested document
1616
subKeys[indx] = retrieveSubHeading(newKey, data[subKey]); // Recur on the subdocument to retrieve the full key name
1717
} else {
1818
subKeys[indx] = (options.DELIMITER.WRAP || '') + (newKey || '') + (options.DELIMITER.WRAP || ''); // Set the key name since we don't have a sub document

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"author": "mrodrig",
33
"name": "json-2-csv",
44
"description": "A JSON to CSV and CSV to JSON converter that natively supports sub-documents and auto-generates the CSV heading.",
5-
"version": "0.1.5",
5+
"version": "1.0.6",
66
"repository": {
77
"type": "git",
88
"url": "http://github.com/mrodrig/json-2-csv.git"
@@ -33,5 +33,6 @@
3333
},
3434
"engines": {
3535
"node": "*"
36-
}
36+
},
37+
"license": "MIT"
3738
}

0 commit comments

Comments
 (0)