Created json utilities
This commit is contained in:
parent
51d49b743d
commit
029e418260
|
@ -0,0 +1,15 @@
|
|||
# Python Imports
|
||||
import json
|
||||
import jsonschema
|
||||
|
||||
|
||||
def read_json(file_path):
|
||||
with open(file_path, "r") as file:
|
||||
json_content = json.load(file)
|
||||
|
||||
return json_content
|
||||
|
||||
|
||||
def validate_json(json_content, json_schema):
|
||||
jsonschema.validate(instance=json_content, schema=json_schema)
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
import json
|
||||
|
||||
|
||||
class ConfigurationFileParser:
|
||||
|
||||
def __init__(self, file_path):
|
||||
self._file_path = file_path
|
||||
|
||||
def read_content(self):
|
||||
# Retrieve raw info
|
||||
data = self._parse_file()
|
||||
|
||||
# Check valid flags depending on simulation ()
|
||||
print("asd")
|
||||
# Parse values
|
||||
|
||||
return "data"
|
||||
|
||||
def _parse_file(self):
|
||||
with open(self._file_path, "r") as file:
|
||||
data = json.load(file)
|
||||
|
||||
return data
|
Loading…
Reference in New Issue