I have this JSON in a file:
{
\"maps\": [
{
\"id\": \"blabla\",
\"iscategorical\
Justin Peel's answer is really helpful, but if you are using Python 3 reading JSON should be done like this:
with open('data.json', encoding='utf-8') as data_file:
data = json.loads(data_file.read())
Note: use json.loads
instead of json.load
. In Python 3, json.loads
takes a string parameter. json.load
takes a file-like object parameter. data_file.read()
returns a string object.
To be honest, I don't think it's a problem to load all json data into memory most cases.