converting JSON to HTML from queries