Summary

tomni.json_operations.summary_json(json_list: List[dict], keyword: str, do_copy: bool = True, rounding: int = 2) tuple[source]

Create a summary of a specified keyword variable inside JSON objects.

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

  • keyword (str) – The keyword for which to create the summary (e.g., ‘area’).

  • do_copy (bool, optional) – When True, copies the JSON list and does not modify it. Defaults to True.

  • rounding (int, optional) – The number of decimals used in the summary. Defaults to 2.

Raises

ValueError – If an unsupported keyword is provided.

Returns

A tuple containing:
  • Number of objects

  • Total sum of the keyword in objects

  • Mean value of the keyword in objects

  • Maximum value of the keyword in objects

  • Minimum value of the keyword in objects

Return type

tuple

Example:

json_list = [
    {"area": 10},
    {"area": 15},
    {"area": 20},
]
keyword = "area"

output = summary_json(json_list, keyword)

result = (3, 45, 15.0, 20, 10)