Mercurial > repos > ufz > dfpl_predict
view json_flatten.py @ 0:8956e949d466 draft default tip
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
author | ufz |
---|---|
date | Thu, 19 Dec 2024 12:51:08 +0000 |
parents | |
children |
line wrap: on
line source
import json from sys import stdin d = json.load(stdin) def flatten(o: dict): d_flat = {} for key, value in o.items(): if type(value) is dict: value = flatten(value) for k, v in value.items(): d_flat[k] = v else: d_flat[key] = value return d_flat d = flatten(d) print(json.dumps(d))