def dump_learn_lists(json_dict, hlir):
    learn_lists = []

    learn_list_ids = field_list_to_learn_id.ids
    for p4_field_list, id_ in learn_list_ids.items():
        learn_list_dict = OrderedDict()
        learn_list_dict["id"] = id_
        learn_list_dict["name"] = p4_field_list.name

        elements = []
        for field in p4_field_list.fields:
            element_dict = OrderedDict()
            if type(field) is not p4.p4_field:  # pragma: no cover
                LOG_CRITICAL("only fields supported in field lists for now")
            element_dict["type"] = "field"
            element_dict["value"] = format_field_ref(field)

            elements.append(element_dict)

        learn_list_dict["elements"] = elements

        learn_lists.append(learn_list_dict)

    learn_lists.sort(key=lambda field_list: field_list["id"])

    json_dict["learn_lists"] = learn_lists