from typing import Dict
from typing import Any
import json


def get_entry_dict_from_json(save_file: str) -> Dict[str, Any]:
    """
    Gets an dictionary from a JSON file, using the latest values if met with a
    list. Useful for analyzing latest log data.

    :param save_file:
        A str representing the file path towards a JSON file you wish to read.


    :return:
        A Dict[str, Any] mapping variable names to their latest values.
    """
    entries = dict()

    with open(save_file) as file:
        for key, value in json.load(file).items():
            entries[key] = value[-1] if isinstance(value, list) else value

    return entries