added expanding arrays in JSON for html tables into javascript function