I am trying to encode an object into json using json.dumps()
in Django, however when I pass in a python object, it raises this error.
TypeError
object
is not one of those types. Dictionaries, lists (maybe tuples), floats, strings, integers, bools, and None I believe are the types that Python can serialize into JSON natively.
However, it looks like Django has some built-in serializers that may work for you.
I'm guessing that
from django.core import serializers
data = serializers.serialize("json", OrgInvite.objects.filter(token=100))
should work for you