title: Methord to convert json data to byte format and back
body: <p>I am using google pub/sub to move data from one module to another , pub/sub needs to data to be encoded into bytes thus my code looks like this </p>
  
  <p>module1</p>
  
  <pre><code>       data = json.dumps(tick[0])
         message_id = topic.publish(data.encode('utf-8'))
  </code></pre>
  
  <p>module2</p>
  
  <pre><code>      json_raw = message.data.decode('utf-8').replace("'",'"')
        jmsg = json.loads(json_raw)
  </code></pre>
  
  <p>here the json.loads raises an error that  "Expecting value: line 1 column 16 (char 15)" how do I fix this during conversion.</p>