aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/ProtocolBuffers/JsonFormatter.cs
diff options
context:
space:
mode:
authorJon Skeet <jonskeet@google.com>2015-07-14 09:41:28 +0100
committerJon Skeet <jonskeet@google.com>2015-07-14 09:41:28 +0100
commit0f34daad07153a66b492ab938e85f17e82b91706 (patch)
tree8fbcaf07c65a3824ddc1a541297a972c1ad469a2 /csharp/src/ProtocolBuffers/JsonFormatter.cs
parent6ea9bc7aa3af5c392fcd8f4eeebf71342c1ce961 (diff)
downloadprotobuf-0f34daad07153a66b492ab938e85f17e82b91706.tar.gz
protobuf-0f34daad07153a66b492ab938e85f17e82b91706.tar.bz2
protobuf-0f34daad07153a66b492ab938e85f17e82b91706.zip
Changes suggested during review.
- Remove the indexers in FieldAccessorTable - Add a TODO for field ordering in oneof
Diffstat (limited to 'csharp/src/ProtocolBuffers/JsonFormatter.cs')
-rw-r--r--csharp/src/ProtocolBuffers/JsonFormatter.cs3
1 files changed, 2 insertions, 1 deletions
diff --git a/csharp/src/ProtocolBuffers/JsonFormatter.cs b/csharp/src/ProtocolBuffers/JsonFormatter.cs
index 3e2244d6..9bd628eb 100644
--- a/csharp/src/ProtocolBuffers/JsonFormatter.cs
+++ b/csharp/src/ProtocolBuffers/JsonFormatter.cs
@@ -141,6 +141,7 @@ namespace Google.Protobuf
{
var descriptor = accessor.Descriptor;
// Oneofs are written later
+ // TODO: Change to write out fields in order, interleaving oneofs appropriately (as per binary format)
if (descriptor.ContainingOneof != null)
{
continue;
@@ -176,7 +177,7 @@ namespace Google.Protobuf
{
continue;
}
- var fieldAccessor = fields[fieldDescriptor];
+ var fieldAccessor = fields[fieldDescriptor.FieldNumber];
object value = fieldAccessor.GetValue(message);
// Omit awkward (single) values such as unknown enum values
if (!fieldDescriptor.IsRepeated && !fieldDescriptor.IsMap && !CanWriteSingleValue(fieldDescriptor, value))