title: Converting Protobuf3 with enum to JSON in Go
body: <p>How can I convert <code>grpc</code>/<code>protobuf3</code> message to <code>JSON</code> where the <code>enum</code> is represented as <code>string</code>?</p>
  
  <p>For example, the <code>protobuf</code> message:</p>
  
  <pre><code>enum Level {
      WARNING = 0;
      FATAL = 1;
      SEVERE = 2;
      ...
  }
  
  message Http {
      string message = 1;
      Level level = 2;
  }
  </code></pre>
  
  <p>Is converted by:</p>
  
  <pre><code>j, _ := json.MarshalIndent(protoMessage, "", "\t")
  </code></pre>
  
  <p>To:</p>
  
  <pre><code>{
      "message": "Hello world!",
      "level": 2,
  }
  </code></pre>
  
  <p>I wish to get:</p>
  
  <pre><code>{
      "message": "Hello world!",
      "level": "SEVERE",
  }
  </code></pre>
  
  <p>Thanks</p>