More tests and fixes for object JSON generation