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

lib/java TSimpleJSONProtocol can emit invalid JSON

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.9.2
    • Component/s: None
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      TSimpleJSONProtocol can emit JSON with maps whose keys are not string (which is not allowed is the JSON spec).

      This happens if the key in a map is anything other than a String (int, enum, etc)

      For example, it can emit JSON like this:

      {"myMap":{5:"myValue"}}
      

      which should be:

      {"myMap":{"5":"myValue"}}
      

      I have a path that fixes this, I'll upload it shortly (still trying to get my dev environment to run the tests).

      Also AFAICT there is no unit test for TSimpleJSONProtocol – I'll try and add one to the patch.

      Thanks!
      Alex

        Attachments

        1. THRIFT-2210-v1.patch
          11 kB
          Alex Levenson

          Activity

            People

            • Assignee:
              alexlevenson Alex Levenson
              Reporter:
              alexlevenson Alex Levenson
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: