File write/json
code: python
import json
def create_json_file(filepath):
data = {
"id": 123,
"nest": {
"a": 1,
"b": 2,
"c": 3
}
}
try:
with open(filepath, 'w') as f:
json.dump(data, f, indent=4)
print(f"File created successfully: {filepath}")
except Exception as e:
print(f"Error creating file: {e}")
if __name__ == "__main__":
create_json_file("test.json")