Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4436

Deserialization of nested list discards content

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.10.0, 0.11.0
    • 0.12.0
    • JavaScript - Library
    • None

    Description

      I'm trying to transmit a list of lists, like this:

      service HelloSvc {
        list<list<string>> test()
      }
      

      Using XHR Transport and JSON Protocol, with a service implementation in Python like this:

      class HelloSvcHandler:
          def __init__(self):
              pass
      
          def test(self,):
              return [
                  ["s1", "s2"],
                  ["s3", "s4"],
                  ["s5"]
              ]
      

      The serialized response looks good to me (seen in browser development tools):

      [1,"test",2,0,{"0":{"lst":["lst",3,["str",2,"s1","s2"],["str",2,"s3","s4"],["str",1,"s5"]]}}]
      

      However, when deserialized to JavaScript, the result looks like this:

      [["s1","s2"],[],[]]
      

      I would expect it to look like this:

      [["s1","s2"],["s3","s4"],["s5"]]
      

      It looks to me like during JSON deserialization, all but the first entry in the list of lists lose their content.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            jking3 James E. King III
            bananer Philip Frank
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Issue deployment