Created json utilities

This commit is contained in:
Alberto 2022-09-29 19:14:47 +02:00
parent 51d49b743d
commit 029e418260
3 changed files with 15 additions and 23 deletions

View File

@ -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)

View File

@ -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