Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flatten_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def _unflatten(dic, keys, value):
list_keys = sorted(flat_dict.keys())
for i, item in enumerate(list_keys):
if i != len(list_keys) - 1:
if not list_keys[i + 1].startswith(list_keys[i]):
if not list_keys[i + 1].startswith(list_keys[i]+'.'):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only accounts when separator=.. I think it should be if not list_keys[i + 1].startswith(list_keys[i]+separator):

_unflatten(unflattened_dict, item.split(separator),
flat_dict[item])
else:
Expand Down