import json


def parse_json(json_file_path):
    """Read JSON file and return relevant data.

    gamemode: "normal", "gravity" or "gravityCTF" (?)
    map_name
    map_author
    marsballs

    """
    gamemode = "normal"
    marsballs = 0

    with open(json_file_path) as f:
        json_data = json.load(f)

        try:
            gamemode = json_data["info"]["gameMode"]
        except KeyError:
            pass

        map_name = json_data["info"]["name"]
        map_author = json_data["info"]["author"]

        try:
            marsballs = len(json_data["marsballs"])
        except KeyError:
            pass

    return gamemode, map_name, map_author, marsballs