yfpy.utils.reorganize_json_dict

reorganize_json_dict(json_dict, obj_key, val_to_key)[source]

Function to reorganize a JSON dictionary of dictionaries.

The reorganized JSON dictionary is an ordered dictionary sorted by a specific attribute of the value dictionaries.

Parameters
  • str (json_dict (dict of) – Any): JSON dictionary.

  • obj_key (str) – Key to access the dictionaries contained in json_dict.

  • val_to_key (str) – Key used to sort the dictionaries contained in json_dict.

Returns

An ordered dictionary of dictionaries sorted by val_to_key.

Return type

dict[str, Any]