Skip to content

Commit a5b8f3b

Browse files
committed
Merge branch 'bids-json-file' of https://github.com/bids-standard/pybids into bids-json-file
2 parents 53fb7ba + 24f6e1c commit a5b8f3b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: bids/layout/models.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,10 @@ class BIDSJSONFile(BIDSFile):
337337

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

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

0 commit comments

Comments
 (0)