I'm writing python variables to json file and I want to include their name with them.
f_name= 'first name'
l_name= 'last name'
import json
with open("file.json", "w") as f:
f.write(f_name+' '+ l_name)
output in json file :
first name last name
I want the output to be like this
[
{
"f_name": "first name",
"l_name": "last name"
}
]