Object of type subscription is not JSON serializable

I use to dumps data into json in django views function.

def payment(request, slug):
package=subscription.objects.get(slug=slug)
print(slug)
data={
    'slug':slug,
    'jsonPackage':json.dumps(package), 
}
return render(request, 'firmApp/subscription/payment.html',data) 

But getting an error:

Object of type subscription is not JSON serializable!!
Back to Top