Avoid json.load(fp) when checking for JSON file

A memory leak caused json.load(fp) to not let go of the memory it used.
Instead, use a simpler check for differentiating between JSON and TSV.
Use iterative line read rather than readlines for converting TSV

This uses much less RAM and allows larger TSV files to be converted on less powerful systems
Still supports both filestreams and list objects as input
_extract_data_from_tsv returns [row, col, val], so test case needed update

A sparse matrix makes more sense here, and uses less RAM
Test case now reflects this change to _extract_data_from_tsv in table.py