made json formatter a little smarter/better