Skip to content

Commit

Permalink
Merge branch 'bids-json-file' of https://github.com/bids-standard/pybids
Browse files Browse the repository at this point in the history
 into bids-json-file
  • Loading branch information
tyarkoni committed May 15, 2019
2 parents 53fb7ba + 24f6e1c commit a5b8f3b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bids/layout/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,10 @@ class BIDSJSONFile(BIDSFile):

def get_dict(self):
''' Return the contents of the current file as a dictionary. '''
return json.loads(self.get_json())
d = json.loads(self.get_json())
if not isinstance(d, dict):
raise ValueError("File %s is a json containing %s, not a dict which was expected" % (self.path, type(d)))
return d

def get_json(self):
''' Return the contents of the current file as a JSON string. '''
Expand Down

0 comments on commit a5b8f3b

Please sign in to comment.