Javascript to display data in matrix format

I have a json file in the google drive below that I am trying to pivot using javascript controller and display on html. Problem is data I want to display is not in a tabular format. It should be in a matrix format. PLease help. Thanks in advance.

I want my data to be pivoted like below