from typing import Dict
from typing import List
from typing import Union


def decode_json_table(json: Dict[str, List[Union[str, List[str]]]]) -> List[dict]:
    """Transforms a 'JSON-table' (of the format below) into a List[dict], with each dict containing
    the data for a single object.

    Args:
        json (dict): A dictionary containing the json-table. Must be of the form:
                     {
                        'header': List[str],
                        'rows': List[List[str]]
                     }

    Note:
        See (https://github.com/servalproject/pyserval-dna/blob/development/doc/REST-API.md#json-table)
        for detailed description

    Returns:
        List[dict]: List of dictionaries containing separate JSON-objects
    """
    data = []

    for row in json["rows"]:
        # transform row of table
        # into dictionary for single object
        data.append(dict(zip(json["header"], row)))

    return data