title: Protobuf3: Serialize a Python object to JSON
body: <p>According to <a href="https://github.com/google/protobuf/releases/tag/v3.0.0" rel="nofollow">the manual</a>, Protobuf 3.0.0 supports JSON serialization:</p>
  
  <blockquote>
    <p>A well-defined encoding in JSON as an alternative to binary proto encoding.</p>
  </blockquote>
  
  <p><strong>What have I tried</strong></p>
  
  <ul>
  <li><code>json.dumps(instance)</code> which raised <code>TypeError(repr(o) + " is not JSON serializable")</code></li>
  <li>Looked for a <code>instance.to_json()</code> (or alike) function</li>
  <li>Searched the Python docs</li>
  </ul>
  
  <p><strong>How do I serialize a Python proto object to JSON?</strong></p>