More JSON generator tests and bug fixes