Convert tasks into json and generate html