Small fixes for Json Encoding

Been playing with this a bit this afternoon and just had a couple of troubles caused by these bits.