Skip to content

Commit

Permalink
add 'JSONParser'
Browse files Browse the repository at this point in the history
  • Loading branch information
sirfoga committed Nov 6, 2017
1 parent 747c381 commit d8d0860
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hal/files/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
""" Parsers for raw databases """

import csv
import json


class Parser(object):
Expand Down Expand Up @@ -93,3 +94,11 @@ def get_dicts(self):
for row in reader:
if row:
yield row


class JSONParser(Parser):
def get_content(self):
with open(self.path, "r") as in_file:
return json.loads(
in_file.read()
) # read and return json object

0 comments on commit d8d0860

Please sign in to comment.