[ 
https://issues.apache.org/jira/browse/THRIFT-2535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14000220#comment-14000220
 ] 

Jake Farrell commented on THRIFT-2535:
--------------------------------------

no, you would not be able to deserialize if this was enabled, probably should 
add some better documentation to the addition. My thinking behind it was to 
reduce code duplication between the two files and get TSimpleJson to something 
like the following

{code}
package org.apache.thrift.protocol;

import org.apache.thrift.transport.TTransport;

/**
 * JSON protocol implementation for thrift.
 *
 * This protocol is intended to be *write-only* and produces a simple output
 * format suitable for parsing by scripting languages.
 */
public class TSimpleJSONProtocol extends TJSONProtocol{

  /**
   * Factory
   */
  public static class Factory implements TProtocolFactory {
    public TProtocol getProtocol(TTransport trans) {
      return new TJSONProtocol(trans, true);
    }
  }

  public TSimpleJSONProtocol(TTransport trans) {
    super(trans, true);
  }
}
{code}

> TJSONProtocol when serialized yields TField ids rather than names
> -----------------------------------------------------------------
>
>                 Key: THRIFT-2535
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2535
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Java - Library
>            Reporter: Jake Farrell
>            Assignee: Jake Farrell
>            Priority: Trivial
>             Fix For: 0.9.2
>
>         Attachments: THRIFT-2535.patch
>
>
> When using the serializer to with TJsonProtocol to output json data the 
> TField id's are printed as the object name rather than the TField name. This 
> works when using Thrift to serialize and deserialize data, but when 
> TJsonProtocol is being used in other applications this can be difficult to 
> deal with. 
> Propose adding an option to serialize the object with the TField name rather 
> than the id's



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to