Added conditional to prevent json being added when attributes don't exist on the model