コード例 #1
0
def load_file_to_dict(path):
    """
    Takes a file path and loads it into a nested json dict
    following the format in json_form_schema.json
    The file may be a xls file or json file.
    If it is xls it is converted using xls2json.
    """
    if path.endswith(".json"):
        name = _section_name(path)
        return name, utils.get_pyobj_from_json(path)
    else:
        name = _section_name(path)
        excel_reader = SurveyReader(path)
        return name, excel_reader.to_json_dict()
コード例 #2
0
ファイル: file_utils.py プロジェクト: XLSForm/pyxform
def load_file_to_dict(path):
    """
    Takes a file path and loads it into a nested json dict
    following the format in json_form_schema.json
    The file may be a xls file or json file.
    If it is xls it is converted using xls2json.
    """
    if path.endswith(".json"):
        name = _section_name(path)
        return name, utils.get_pyobj_from_json(path)
    else:
        name = _section_name(path)
        excel_reader = SurveyReader(path)
        return name, excel_reader.to_json_dict()
コード例 #3
0
ファイル: builder.py プロジェクト: vimagox/pyxform
def create_survey_element_from_json(str_or_path):
    d = utils.get_pyobj_from_json(str_or_path)
    return create_survey_element_from_dict(d)
コード例 #4
0
ファイル: builder.py プロジェクト: lindsay-stevens/pyxform
def create_survey_element_from_json(str_or_path):
    d = utils.get_pyobj_from_json(str_or_path)
    return create_survey_element_from_dict(d)