omnipy.components.json.flows
JSON flows for flattening and transposing structured JSON datasets.
| FUNCTION | DESCRIPTION |
|---|---|
flatten_nested_json |
Flatten nested JSON records into scalar-only records. |
transpose_dict_of_dicts_2_list_of_dicts |
Transpose a dataset of dictionaries of dictionaries into lists of dictionaries. |
transpose_dicts_of_lists_of_dicts_2_lists_of_dicts |
Transpose a dataset of dictionaries of lists of dictionaries into lists of dictionaries. |
flatten_nested_json
flatten_nested_json(
dataset: JsonListOfDictsDataset, id_key: str, ref_key: str, default_key: str
) -> JsonListOfDictsOfScalarsDataset
Flatten nested JSON records into scalar-only records.
Repeatedly flattens one nesting level at a time until only dictionaries of scalars remain.
Source code in src/omnipy/components/json/flows.py
transpose_dict_of_dicts_2_list_of_dicts
transpose_dict_of_dicts_2_list_of_dicts(
dataset: JsonDictOfDictsDataset, id_key: str = ID_KEY
) -> JsonListOfDictsDataset
Transpose a dataset of dictionaries of dictionaries into lists of dictionaries.
Adds the original outer key to each emitted record under id_key.
Source code in src/omnipy/components/json/flows.py
transpose_dicts_of_lists_of_dicts_2_lists_of_dicts
transpose_dicts_of_lists_of_dicts_2_lists_of_dicts(
dataset: JsonDictOfListsOfDictsDataset, id_key: str = ID_KEY
) -> JsonListOfDictsDataset
Transpose a dataset of dictionaries of lists of dictionaries into lists of dictionaries.
Adds the original outer key to each emitted record under id_key.