Human: write dict to json file in. Assistant: 
Here is a Python code to write dict to a json file

import json

def write_dict_to_json(dictionary, file_path):
    """
    Write a dictionary to a json file.
    """
    with open(file_path, 'w') as f:
        json.dump(dictionary, f, indent=4)

# Enter the dictionary
dictionary = {"a": 1, "b": 2}

# Enter the file path
file_path = "test.json"

# Calling the function
print((write_dict_to_json(dictionary, file_path)))

#Example Output
# None

#Remember to inspect code for bugs.