This is also related to issue #43 but in the case where our nested dictionary has empty lists []
In this case, not only do we have the empty <FlatterDict {}>, but in the flat form it encodes the empty list as an empty dictionary instead.
In the original as_dict() form it is correct as you would expect. The issue is in the flattened form.
Here is a simple example
dict_ = {"age": 25, "siblings": []}
flat = flatdict.FlatterDict(dict_)
print(flat.as_dict())
print([(k, v) for k, v in flat.items()])
print(flat['siblings'])
Outputs
{'age': 25, 'siblings': []}
[('age', 25), ('siblings', <FlatterDict id=5520522448 {}>")]
{} # wrong should be []
This is also related to issue #43 but in the case where our nested dictionary has empty lists
[]In this case, not only do we have the empty
<FlatterDict {}>, but in the flat form it encodes the empty list as an empty dictionary instead.In the original
as_dict()form it is correct as you would expect. The issue is in the flattened form.Here is a simple example
Outputs