refactored how json is rendered