Unable to parse data
I just printed data = json.loads(somepostmessage)
Output of data:
{'number': 'INC0010021', 'title': 'ghjghjgh', 'description': 'test creating sericenow tickets through post', 'state': 'New', 'priority': 'Planning', 'assigned_to': '', 'caller_id': ''}
Code:
if request.method == 'POST':
print(request.body)
print(json.loads(request.body))
print(type(json.loads(request.body)))
data = json.loads(request.body)
print(data['number'])
return Response({"message": "Data mismatching"})
I was trying to parse through it data['number']
:
Error: String indices must be integers