Skip to content

Issue with unflatten #81

Description

@mritay

When there is a flattened field with a "duplicated" inner part there's an error:
AttributeError: ‘str’ object has no attribute ‘setdefault’
The problematic json:

{
     "field": "",
     "field.inner.part": "123"
}

While this would work:

{
     "field.inner.part": "123"
}

And this would also work:

{
     "field": "",
     "field.inner": "", 
     "field.inner.part": "123"
} 

The desired output for all cases above should be:

{“field”: {“inner”: {“part”: “123”}}}

The function used is:

unflatten_list(example, separator=".")

I don't have a way of removing the "duplicated" ones as this is the way some users input their flattened json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions