title: How do I convert json string to protobuf message object?
body: <pre><code>message Example {
      enum State {
          Deleted = 1;
          Inactive = 2;
          Active = 4;
      }
  
      optional uint64 id                       = 1        [(gson_name) = "id"];
      optional uint64 state                    = 2        [(gson_name) = "state"];
      optional uint64 userId                   = 3        [(gson_name) = "uui"];
      optional sint32 marketId                 = 4        [(gson_name) = "m"];
      optional uint64 productId                = 5        [(gson_name) = "p"];
  }
  </code></pre>
  
  <p>Json String</p>
  
  <pre><code>v: String = {"m": 97, "state": 1, "uui": 1, "id": 1, "p": 1}
  </code></pre>
  
  <p>Call to convert using json that fails.</p>
  
  <pre><code>gson.fromJson(v, classOf[Example])
  </code></pre>
  
  <p>Exception
  java.lang.NullPointerException</p>
  
  <p>I am not sure if this is a correct way of converting json to generated proto class. Could someone please tell me what am I doing wrong or perhaps suggest some other method to accomplish this. I am on protobuf version 2.6 and can't really move upto 3 for this project.</p>