Properly generates JSON using Writers