I am new to Python and I have this json file which I want to build manually by assinging data to the values. An example below is the variable of teacher. If I print my json, I want the apiStatus value be replaced with the variable
import pprint
import json
def testbobo():
variable = "Teacher"
jsonfile = f''' {
"apiStatusInfo": {
"apiStatus": {variable},
"apiStatusCode": 100,
"apiDescription": "Error with folder 'Admin'",
"apiErrorCode": 404,
"apiErrorDescription": [
{
"reason": "invalid_parameter",
"name": "item",
"message": "Invalid value 'd_1097790817140'. not found"
}
]
}
}'''
print(jsonfile)
testbobo()
When I tried this, I got the error message below. How can I build a json file manually
SyntaxError: f-string: expressions nested too deeply