Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with '.' in keys #21

Open
drmrbrewer opened this issue Nov 16, 2016 · 5 comments
Open

Doesn't work with '.' in keys #21

drmrbrewer opened this issue Nov 16, 2016 · 5 comments

Comments

@drmrbrewer
Copy link

When the key name has a '.' this seems to fool json2xls, e.g.

{"lang.contextButtonTitle":"nice", "lang.decimalPoint":"true"}

I wouldn't normally use '.' in a key, but these were added automatically by a json flattener (https://www.npmjs.com/package/flat)

@rikkertkoppes
Copy link
Owner

Thanks for the report. I'm not sure what to do with this. There seem to be two options:

  • allow dots in keys as you describe
  • when resolving fields from the json, treat fields with dots as json paths and descend into the structure.

What I may end up doing is checking whether the key exists and if not, try to descend into the structure.

In any case, the current behaviour seems flawed

@drmrbrewer
Copy link
Author

Seems sensible, thanks. Incidentally the 'flat' module that caused this in the first place (by using '.' in the key names) has a 'delimiter' option anyway, so in my case it's easy to avoid the problem by using a delimiter like '_' instead of '.' (and your module then works just fine). But I thought I'd mention it anyway.

@xdadda
Copy link

xdadda commented Jan 26, 2017

have the same problem here. Column name has a '.'
In my case I cannot switch do another delimiter as the export format is a given
could you please fix it?
many thanks

@jonaswindey
Copy link

I would also suggest to allow dots in column names, it's used quite regularly (for instance a column "Invoice Nr.")

I would advise using object-path to retrieve the value (it allows default values if path is not found) https://github.com/mariocasciaro/object-path

@sunilksamanta
Copy link

Got the same problem. There is a pull request too on this. Waiting for the fix. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants