I converted the python dictionary into a python object, but I can't display the values of the sub-array D
Views.py
def dictToObject(request):
dictionnaire={'A': 1, 'B': {'C': 2},'D': ['E', {'F': 3}],'G':4}
obj=json.loads(json.dumps(dictionnaire))
context={'obj':obj}
return render(request,'cart/cart_detail.html',context)
cart_detail.html
{{ obj.D[0] }}
{{ obj.D[1].F }}
I get an error (Could not parse the remainder: '[0]' from 'obj.D[0]'), I don't know why?