Fix #678: NPE in JSONCodec

Signed-off-by: Neil Bartlett <njbartlett@gmail.com>
Merge pull request #679 from njbartlett/nb/json-npe

Fix #678: NPE in JSONCodec