Skip to content

Commit 77f53e5

Browse files
committed
adding function to read json
1 parent 7749102 commit 77f53e5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

singularity/utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,15 @@ def read_file(filename,mode="r"):
225225
return content
226226

227227

228+
def read_json(filename,mode='r'):
229+
'''read_json reads in a json file and returns
230+
the data structure as dict.
231+
'''
232+
with open(filename,mode) as filey:
233+
data = json.load(filey)
234+
return data
235+
236+
228237
############################################################################
229238
## OTHER MISC. #############################################################
230239
############################################################################

0 commit comments

Comments
 (0)