aboutsummaryrefslogtreecommitdiffstats
path: root/config_file/parsers/json_parser.py
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2020-02-02 07:02:27 -0600
committerEugene Triguba <eugenetriguba@gmail.com>2020-02-02 07:02:27 -0600
commit99ef9872805366675f495a66594f3cd2aea68ac7 (patch)
tree1a1b10b0379a2bb5d1c7264655f9cd7db62736db /config_file/parsers/json_parser.py
parentMerge branch 'json' of github.com:eugenetriguba/config_file into json (diff)
downloadconfig-file-99ef9872805366675f495a66594f3cd2aea68ac7.zip
Finish get method for json parser
Diffstat (limited to 'config_file/parsers/json_parser.py')
-rw-r--r--config_file/parsers/json_parser.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/config_file/parsers/json_parser.py b/config_file/parsers/json_parser.py
index c017b37..c7c20fb 100644
--- a/config_file/parsers/json_parser.py
+++ b/config_file/parsers/json_parser.py
@@ -3,6 +3,8 @@ import json
from nested_lookup import get_occurrence_of_key
from config_file.parsers.base_parser import BaseParser, ParsingError
+from config_file.parsers.parse_value import parse_value
+from config_file.utils import split_on_dot
class JsonParser(BaseParser):
@@ -17,7 +19,13 @@ class JsonParser(BaseParser):
raise ParsingError(error)
def get(self, section_key, parse_type=True):
- pass
+ split_keys = split_on_dot(section_key)
+
+ result = self.parsed_content
+ for key in split_keys:
+ result = result[key]
+
+ return parse_value(result) if parse_type else result
def set(self, section_key, value):
pass