Fix JSON serializer for enum types
Fix JSON serializer for enum types

Summary: Ensure that objects passed to writeJSONNumber are actually integers. In some cases, objects with a __str__() which represent numbers (such as some integer enums) get serialized as their class name instead of their integer value. This fixes that.

Reviewed By: yfeldblum, JianlongZhong

Differential Revision: D12832589

fbshipit-source-id: f3a9b28eced9b7f9abe03656482a2d6bc7aa776e

facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift