Skip to content

Commit

Permalink
Add support for keys with nested dots.
Browse files Browse the repository at this point in the history
Through modifications to `doc-path` and `deeks` dependency underlying
code, I've worked to add support for the keys with nested dots in the
JSON key path and conversion back to CSV. This was achieved through the
`deeks` module's new `escapeNestedDots` option which will now be set to
`true`. Additionally, support for this escaping was added to `doc-path`
so that the correct values are retrieved and can also be correctly set
for csv2json. This commit adds the option specification for the `deeks`
module and the updated versions of the dependency modules in
package.json.

Fixes #184
  • Loading branch information
mrodrig committed May 26, 2021
1 parent 2183282 commit 4251a49
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
3 changes: 2 additions & 1 deletion lib/json2csv.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const Json2Csv = function(options) {
expandingWithoutUnwinding = options.expandArrayObjects && !options.unwindArrays,
deeksOptions = {
expandArrayObjects: expandingWithoutUnwinding,
ignoreEmptyArraysWhenExpanding: expandingWithoutUnwinding
ignoreEmptyArraysWhenExpanding: expandingWithoutUnwinding,
escapeNestedDots: true
};

/** HEADER FIELD FUNCTIONS **/
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"name": "json-2-csv",
"description": "A JSON to CSV and CSV to JSON converter that natively supports sub-documents and auto-generates the CSV heading.",
"version": "3.13.0",
"version": "3.14.0",
"homepage": "https://mrodrig.github.io/json-2-csv",
"repository": {
"type": "git",
Expand Down Expand Up @@ -39,8 +39,8 @@
"cli"
],
"dependencies": {
"deeks": "2.3.0",
"doc-path": "2.3.0"
"deeks": "2.4.0",
"doc-path": "3.0.0"
},
"devDependencies": {
"babel-eslint": "10.1.0",
Expand Down

0 comments on commit 4251a49

Please sign in to comment.