Refactor pretty json printing methods