title: How to unmarshal JSON into protobuf containing oneof definitions using jsonpb?
body: <p>I'm currently failing to unmarshal a JSON snippet which is generated by <em>jsonpb</em>. Maybe it's just some kind of misunderstanding on my side, but when looking at the tests I'd expect it to work somehow.</p>
  
  <p>Here's the relevant snippet of the <code>pb.proto</code>:</p>
  
  <pre><code>syntax = "proto3";
  package pb;
  
  message Parameter {
      string name = 1;
      oneof value {
          string str_value = 2;
          int32 int_value = 3;
          bool bool_value = 4;
          float float_value = 5;
      }
  }
  
  message ParameterSet {
      bytes raw = 1;
      repeated Parameter parameters = 2;
  }
  
  message ParameterSets {
      map&lt;string,ParameterSet&gt; sets = 1;
  }
  </code></pre>
  
  <p>Testing marshaling/unmarshaling using this simple snippet fails:</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "github.com/gogo/protobuf/jsonpb"
      "strings"
  )
  
  func main() {
      m := jsonpb.Marshaler{}
      str, err := m.MarshalToString(&amp;pb.ParameterSets{Sets: map[string]*pb.ParameterSet{
          "parameter": {
              Raw: []byte{0, 1, 2, 3, 4, 5, 6, 1, 2},
              Parameters: []*pb.Parameter{
                  {Name: "itest", Value: &amp;pb.Parameter_IntValue{42}},
                  {Name: "stest", Value: &amp;pb.Parameter_StrValue{"Foobar"}},
                  {Name: "btest", Value: &amp;pb.Parameter_BoolValue{true}},
                  {Name: "ftest", Value: &amp;pb.Parameter_FloatValue{41.99}},
             },
          },
      }},)
      fmt.Println(str)
      fmt.Println(err)
  
      sets := pb.ParameterSets{}
      err = jsonpb.Unmarshal(strings.NewReader(str), &amp;sets)
      fmt.Println(sets)
      fmt.Println(err)
  }
  </code></pre>
  
  <p>It results in:</p>
  
  <pre><code>{"sets":{"parameter":{"raw":"AAECAwQFBgEC","parameters":[{"name":"itest","intValue":42},{"name":"stest","strValue":"Foobar"},{"name":"btest","boolValue":true},{"name":"ftest","floatValue":41.99}]}}}
  &lt;nil&gt;
  {map[]}
  unknown field "intValue" in pb.Parameter
  </code></pre>
  
  <p>How can I get the <em>oneof</em> values back in the proto object?</p>