Hello,
I have the following code that I need help encoding to JSON and appending the data to a file, foo.json
Here is my code:
user = request.user
print 'USER ID ', user.id // 83
sour = json.dumps({"toast" : [{"uid" : user.id }]})
print 'Sour Toast: ', sour.toast # I'm getting this error: AttributeError: 'str' object has no attribute 'toast'
Basically I want to create a json file which contains the user.id value that can accessible from my front end through jQuery.
If anyone can help me with the error I'm getting or with any tips on where to go after i fix this error, I would greatly appreciate it.