json2dict

tomni.transformers.json2dict(json_list: List[dict], keywords: list = ['type', 'area', 'center', 'id']) dict[source]

Transform a list of JSON objects in standard AxionBio format into a dictionary using a list of specified keywords. The resulting dictionary contains lists of values extracted from the JSON objects for each keyword, as well as an “index” list with object indexes.

Parameters
  • json_list (List[dict]) – A list of JSON objects in standard AxionBio format.

  • keywords (List[str], optional) – A list of keywords to extract from the JSON objects. Defaults to [“type”, “area”, “center”, “id”].

Returns

A dictionary containing lists of values for each keyword extracted

from the JSON objects, including an “index” list with object indexes.

Return type

Dict[str, list]