diff options
author | Jon Skeet <skeet@pobox.com> | 2015-11-05 17:09:37 +0000 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2015-11-05 17:09:37 +0000 |
commit | 3a72a1eeafa4cd6747d0039a527caa49924aa265 (patch) | |
tree | 422b0f158bafa07add24648fd1387a4a7d1359b8 /csharp/src/Google.Protobuf/JsonParser.cs | |
parent | 25c045a1800c681443427379953e7380aa5eb6fe (diff) | |
parent | 6a942735497e185bb5fc0a3d1e8698726dc754c9 (diff) |
Merge pull request #940 from jskeet/json-names
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.cs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/csharp/src/Google.Protobuf/JsonParser.cs b/csharp/src/Google.Protobuf/JsonParser.cs index 8da57745..85ef1a01 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(); |