aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf/JsonParser.cs
diff options
context:
space:
mode:
authorGravatar Jon Skeet <jonskeet@google.com>2015-11-04 09:09:14 +0000
committerGravatar Jon Skeet <jonskeet@google.com>2015-11-04 09:09:14 +0000
commit6a942735497e185bb5fc0a3d1e8698726dc754c9 (patch)
tree365fa8efb3ee4cae43d3df5a2cd62e1db441e11e /csharp/src/Google.Protobuf/JsonParser.cs
parentb6a32e909b1f58f157c19276af233e44627093f4 (diff)
Move the creation of the "fields by JSON name" dictionary to the descriptor.
Diffstat (limited to 'csharp/src/Google.Protobuf/JsonParser.cs')
-rw-r--r--csharp/src/Google.Protobuf/JsonParser.cs7
1 files changed, 1 insertions, 6 deletions
diff --git a/csharp/src/Google.Protobuf/JsonParser.cs b/csharp/src/Google.Protobuf/JsonParser.cs
index 6d2638d9..9710e675 100644
--- a/csharp/src/Google.Protobuf/JsonParser.cs
+++ b/csharp/src/Google.Protobuf/JsonParser.cs
@@ -37,7 +37,6 @@ using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
-using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
@@ -164,11 +163,7 @@ namespace Google.Protobuf
throw new InvalidProtocolBufferException("Expected an object");
}
var descriptor = message.Descriptor;
- // TODO: Make this more efficient, e.g. by building it once in the descriptor.
- // Additionally, we need to consider whether to parse field names in their original proto form,
- // and any overrides in the descriptor. But yes, all of this should be in the descriptor somehow...
- // the descriptor can expose the dictionary.
- var jsonFieldMap = descriptor.Fields.InDeclarationOrder().ToDictionary(field => JsonFormatter.ToCamelCase(field.Name));
+ var jsonFieldMap = descriptor.Fields.ByJsonName();
while (true)
{
token = tokenizer.Next();