[Fixed]-Serialization is returning each character as object

1👍

Once you have a JSON, it’s basically a string – so you can not access it like a dictionary/list or any Python type.

If you need to access it like a dictionary or a list, you should operate on the non serialized data:

def query(request):
    posts = Post.objects.all()

    print(posts[0]) # You can now use it as a list of objects

    data = serializers.serialize('json', posts)
    response = JsonResponse(data, safe=False)
    return response
👤masnun

Leave a comment