from django.core import serializers
some_objects = MyClass.objects.all()
s = serializers.serialize('json', some_objects, use_natural_keys=True)
s = re.sub('"pk": [0-9]{1,5}', '"pk": null', s)
Excluding primary key in Django dumpdata with natural keys