{"id":24783,"library":"unflatten","title":"unflatten","description":"Unflatten dicts to dicts with nested dicts/arrays. Current version 0.2.0. Release cadence: low (last release ~2021).","status":"active","version":"0.2.0","language":"python","source_language":"en","source_url":"https://github.com/dairiki/unflatten","tags":["unflatten","dict","nested","flatten"],"install":[{"cmd":"pip install unflatten","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"unflatten is a function, not a module. Use direct import.","wrong":"import unflatten","symbol":"unflatten","correct":"from unflatten import unflatten"}],"quickstart":{"code":"from unflatten import unflatten\nflat = {'a.b.c': 1, 'a.b.d': 2, 'a.e': 3}\nresult = unflatten(flat)\nprint(result)","lang":"python","description":"Basic usage: unflatten a flat dict with dot-separated keys into nested dict."},"warnings":[{"fix":"Use unflatten(flat, delimiter='.') with dot-separated keys.","message":"Version 0.2.0 changed default delimiter from '.' to '/'. To use dot notation, pass delimiter='.' explicitly.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Example: from unflatten import split, unflatten; unflatten({'a.0.b': 1}, splitter=lambda s: [int(p) if p.isdigit() else p for p in split(s, '.')])","message":"The library does not automatically handle integer keys for list indices. You must specify a 'splitter' that returns ints or parse manually.","severity":"gotcha","affected_versions":"all"},{"fix":"Avoid None values in input dict or handle separately.","message":"Using 'None' as a value in the flat dict may cause unexpected behavior (treated as missing). This behavior is undocumented and may change.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use: `from unflatten import unflatten`","cause":"Trying to call unflatten.unflatten() after doing `import unflatten` instead of `from unflatten import unflatten`.","error":"AttributeError: module 'unflatten' has no attribute 'unflatten'"},{"fix":"Specify delimiter: unflatten(flat, delimiter='.')","cause":"Using default delimiter '/' but keys contain dots (or vice versa). Version 0.2.0 changed default delimiter to '/'.","error":"KeyError: 'a.b.c'"},{"fix":"Upgrade to 0.2.0: pip install --upgrade unflatten","cause":"splitter argument is available only in version 0.2.0+. Older version does not support it.","error":"TypeError: unflatten() got an unexpected keyword argument 'splitter'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}