write me script that shows the saves a dictionnary in json format in a file in python
```py
import json

# Define the dictionary
data = {
    "name": "John Doe",
    "age": 30,
    "city": "New York"
}

# Open the file for writing
with open("data.json", "w") as file:
    # Write the dictionary to the file in JSON format
    json.dump(data, file)
    
print("Data saved successfully!")
```