Added JSONCodecTest and fixed a bug exposed by the tests.

Removed unnecessary utf8.
Merge pull request #1 from keithj/master

Added JSONCodecTest and fixed a bug exposed by the tests