You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Alex Levenson (JIRA)" <ji...@apache.org> on 2013/09/26 09:52:02 UTC
[jira] [Commented] (THRIFT-2210) lib/java TSimpleJSONProtocol can
emit invalid JSON
[ https://issues.apache.org/jira/browse/THRIFT-2210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13778557#comment-13778557 ]
Alex Levenson commented on THRIFT-2210:
---------------------------------------
One more issue: thrift allows for maps whose keys are structs / containers, and there's no way to turn that kind of map into JSON -- though the thrift website says to avoid creating IDLs with maps like that.
I think TSimpleJSONProtocol should at least handle these cases by either throwing an exception or (maybe?) skipping these fields? Or emit a sentinel map like {"error": "this map couldn't be serialized to json by TSimpleJSONProtocol"}?
> lib/java TSimpleJSONProtocol can emit invalid JSON
> --------------------------------------------------
>
> Key: THRIFT-2210
> URL: https://issues.apache.org/jira/browse/THRIFT-2210
> Project: Thrift
> Issue Type: Bug
> Reporter: Alex Levenson
>
> 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:
> {noformat}
> {"myMap":{5:"myValue"}}
> {noformat}
> which should be:
> {noformat}
> {"myMap":{"5":"myValue"}}
> {noformat}
> 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
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira