import json
def json_serialize(name, ftype, path):
prof_info = []
prof_info.append({
'profile_name': name,
'filter_type': ftype
})
with open(path, "w") as f:
json.dumps({'profile_info': prof_info}, f)
json_serialize(profile_name, filter_type, "/home/file.json")
The above code does not upload data to file.json. When I write printto json.dumps(), then the data is printed on the screen. But it does not get into the file.
The file is created, but when you open it (using notepad), there is nothing. Why?
How to fix it?
source
share