Json.write seems to work properly now.