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

Several issues with flatten_preserve_lists #79

Open
imbalu007 opened this issue Oct 1, 2021 · 0 comments
Open

Several issues with flatten_preserve_lists #79

imbalu007 opened this issue Oct 1, 2021 · 0 comments

Comments

@imbalu007
Copy link

imbalu007 commented Oct 1, 2021

I found the following issues with flatten_preserve_lists

  1. flatten_preserve_lists({'K': ['abc', [1, 2, 3]]}, separator="+") results in the error re.error: nothing to repeat at position 1

  2. flatten_preserve_lists({'K': ['abc', [1, 2, 3]]}, separator="=+") (note that the 'separator' is '=+' and not '+' as in the previous case)

  • output: [{'K=+0=+1=+0=+1=+2': None, 'K=+0=+1=+0=+1': None, 'K=+0=+1=+0': None, 'K=+0': None, 'K': 'abc'}, {'K=+0=+1=+0=+1=+2': None, 'K=+0=+1=+0=+1': None, 'K=+0=+1=+0': None, 'K=+0': None, 'K': 1}, {'K=+0=+1=+0=+1=+2': None, 'K=+0=+1=+0=+1': None, 'K=+0=+1=+0': None, 'K=+0': None, 'K': 2}, {'K=+0=+1=+0=+1=+2': None, 'K=+0=+1=+0=+1': None, 'K=+0=+1=+0': None, 'K=+0': None, 'K': 3}]
  • expected: {'K': ['abc', [1, 2, 3]]} as the input is not nested
  1. flatten_preserve_lists({'K': ['abc', [[1, 2, 3]]]}, separator="=+")
  • output: [{'K=+0=+1=+0=+0=+1': None, 'K=+0=+1=+0=+0=+1=+2': None, 'K=+0=+1=+0=+0': None, 'K=+0': None, 'K': 'abc'}, {'K=+0=+1=+0=+0=+1': None, 'K=+0=+1=+0=+0=+1=+2': None, 'K=+0=+1=+0=+0': None, 'K=+0': None, 'K': [1, 2, 3]}]
  • expected: {'K': ['abc', [[1, 2, 3]]]} as the input is not nested
  1. flatten_preserve_lists({'K': ['abc', [1, 2, 3]]})
  • output: [{'K': 'abc'}, {'K': 1}, {'K': 2}, {'K': 3}]
  • expected: {'K': ['abc', [1, 2, 3]]} as the input is not nested
  1. flatten_preserve_lists({'K': ['abc', [[1, 2, 3]]]})
  • output: [{'K': 'abc'}, {'K': [1, 2, 3]}]
  • expected: {'K': ['abc', [1, 2, 3]]} as the input is not nested

I am working with the latest version of flatten_json, which is currently 0.1.13

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

1 participant