def try_read_wrong_file():
    print("== try_read_wrong_file ===========================================")
    # Create instance
    parser = JsonManager('parser')
    # Try to parse wrong file
    successful, json_data = parser.read_json_from_file("wrong_file.json")
    print("successful? %s with data: %s" % (successful, json_data))
    print("==================================================================")
    return
def try_create_file_from_csv():
    print("== try_create_file_from_csv ===========================================")
    input_path = os.path.join(full_path_name, "input/")
    output_path = os.path.join(full_path_name, "output/")

    # Create instance
    parser = JsonManager('parser')
    parser.set_input_path(input_path)
    parser.set_output_path(output_path)

    # Try to create json object
    successful, json_data = parser.create_json_object_from_csv("csv_file.csv", ';')
    parser.print_all_json_values(json_data)
    print("successful? %s" % successful)
    parser.write_json("test_csv_output.json", json_data)
    print("==================================================================")
    return
def try_edit_file_with_list():
    print("== try_edit_without_copy ===========================================")
    filename = "test.json"

    # Create instance
    parser = JsonManager('parser')
    os.path.join(full_path_name, "input")

    json_values_array = []
    json_values_array.append(["a", "new a value"])
    json_values_array.append(["b", "new b value"])
    json_values_array.append(["c", "new c value"])

    successful, json_data = parser.read_json_from_file(filename)
    if successful == True:
        print("Processing...")
        successful, json_data = parser.edit_json_from_lists(json_data, json_values_array)
        print("Saving...")
        parser.write_json(filename, json_data)

    print("==================================================================")
    return
def try_create_file_from_list():
    print("== try_create_file_from_list ===========================================")
    output_path = os.path.join(full_path_name, "output/")
    json_values_array = []
    json_values_array.append(["key1", "value1"])
    json_values_array.append(["key2", "value2"])
    json_values_array.append(["key3", "value4"])

    # Create instance
    parser = JsonManager('parser')
    parser.set_output_path(output_path)

    # Try to create json object
    successful, json_data = parser.create_json_object_from_list(json_values_array, True)
    parser.print_all_json_values(json_data)
    print("successful? %s" % successful)
    parser.write_json("test_output.json", json_data)
    print("==================================================================")
    return
def try_read_file():
    print("== try_read_file ===========================================")

    # Configure variables to provide to class sample
    #############################################################
    jsonkeys = ['a', 'b', 'd']
    input_path = os.path.join(os.getcwd(), "input/")

    # Create instance
    parser = JsonManager('parser')
    # Set array with keys
    parser.set_key_array(jsonkeys)
    # Set input path
    parser.set_input_path(input_path)
    # Parse json file
    successful, json_data = parser.read_json_from_file("test.json")
    print("successful? %s" % successful)

    # Get a value if exist or print error
    value = parser.get_value(json_data, 'f')
    print("Value is: %s" % value)
    # Print and get a value
    value = parser.print_json_value(json_data, 'a')
    # Print all json values
    parser.print_all_json_values(json_data)
    # Print only values in array
    parser.print_arraykey_json_values(json_data, jsonkeys)
    print("==================================================================")
    return