def parse_arp_data(data):
    arp_table = []

    if "data" in data:
        raw_data = data["data"]

        for line in raw_data.split("\n"):
            if line.strip() and not line.startswith("Address") and "---" not in line:
                arp_info = line.split()
                if len(arp_info) >= 4:
                    arp_table.append({
                        "address": arp_info[0],
                        "interface": arp_info[1],
                        "link_layer_address": arp_info[2],
                        "state": arp_info[3]
                    })

    return arp_table
    
def generate_arp_json(arp_table):
    return {"arp_table": arp_table}