title: How to deserialize a django model object?
body: <p>I am fairly new to python and transitioning from Java, so I'll use the Java terminologies as I need to know the equivalent python version of it.</p>
  
  <p>So I have a Django model as described below:</p>
  
  <pre><code>class Order(models.Model) :
      order_id = models.TextField(null=False, blank=False)
      is_completed = models.BooleanField(null=False, blank=False, default=False)
  </code></pre>
  
  <p>Also I have a <strong>kafka broker</strong> to process these orders. To push these into a kafka queue, I am transforming them into JSON objects as depicted below:</p>
  
  <pre><code>from django.core import serializers
  
  serialized_obj = serializers.serialize('json', [order])
  print("Pushing to kafka topic ", "some_topic")
  print(serialized_obj)
  send_message("some_topic", serialized_obj)
  </code></pre>
  
  <p>Now I need this JSON object to be converted back to Django model object, in <strong>Java</strong> we have something called as <a href="https://github.com/FasterXML/jackson" rel="nofollow noreferrer">Jackson</a> which could have done the same for me, but I am not sure how to do this in Python3.</p>
  
  <p>I tried the below code snippet, it returned me an object of type <code>&lt;generator object Deserializer at 0x7fe000323bf8&gt;</code></p>
  
  <pre><code># consumer.py
  try:
    print(json.loads(msg.value()))
    print("---------------------------------")
    obj = serializers.deserialize("json", msg.value())
    print(obj)
    except Exception as e:
      import traceback
      print(traceback.format_exc())
  </code></pre>
  
  <p>How can I achieve this in Python3?</p>