Add a test that demonstrates the problem.
Split out a method on the encoder.
Use new method to ensure proper JSON encoding after proper type conversion.
merge MMcM: Use normal type conversion for JSON output from a routine

Merge pull request #1293 from MMcM/sql-layer/json-routine-type-conversion
https://github.com/FoundationDB/sql-layer/pull/1293