KAZOO-806 encoding and json improvements