I have data, which look like [["header","row"],["5","16"], ...] In case they are saved in file, they can be easily read by
with open(input_data, 'r') as f:
data = json.load(f)
It should be possible to read them into data straightforwardly but somehow the input string can't be converted to json data = json.loads(x) returns ValueError: No JSON object could be decoded
What am I missing?
f.read()vs. justf–json.load(f.read()). You're currently trying to load the File Object itself rather than the string of JSON from the file on disk.json.load(x)is correct ifxis an file object.json.loads(x)should be used ifxis a string. --- Your code example showsloadbut your error showsloads; which one is it?