Fix #678: NPE in JSONCodec

Signed-off-by: Neil Bartlett <njbartlett@gmail.com>