diff --git a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs index ef6d63dbdc08..3df906257e16 100644 --- a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs +++ b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs @@ -995,6 +995,16 @@ public void Proto2_DefaultValuesPreserved() Assert.AreEqual(0, parsed.FieldName13); } + [Test] + public void Proto2_Group() + { + string json = "{ \"data\": { \"groupInt32\": 2, \"groupUint32\": 3 } }"; + var parsed = TestAllTypesProto2.Parser.ParseJson(json); + Assert.True(parsed.HasData); + Assert.AreEqual(2, parsed.Data.GroupInt32); + Assert.AreEqual(3, parsed.Data.GroupUint32); + } + [Test] [TestCase("5")] [TestCase("\"text\"")] diff --git a/csharp/src/Google.Protobuf/JsonParser.cs b/csharp/src/Google.Protobuf/JsonParser.cs index 1a0da4a39236..fcf859daba09 100644 --- a/csharp/src/Google.Protobuf/JsonParser.cs +++ b/csharp/src/Google.Protobuf/JsonParser.cs @@ -330,7 +330,7 @@ private bool TryParseSingleValue(FieldDescriptor field, JsonTokenizer tokenizer, } var fieldType = field.FieldType; - if (fieldType == FieldType.Message) + if (fieldType == FieldType.Message || fieldType == FieldType.Group) { // Parse wrapper types as their constituent types. // TODO: What does this mean for null?