mirror of
https://github.com/netinvent/npbackup.git
synced 2026-01-21 15:00:48 +08:00
14 lines
404 B
Python
14 lines
404 B
Python
import json
|
|
|
|
from . import Loader, I18nFileLoadError
|
|
|
|
class JsonLoader(Loader):
|
|
"""class to load json files"""
|
|
def __init__(self):
|
|
super(JsonLoader, self).__init__()
|
|
|
|
def parse_file(self, file_content):
|
|
try:
|
|
return json.loads(file_content)
|
|
except json.JSONDecodeError as e:
|
|
raise I18nFileLoadError("invalid JSON: {0}".format(e.args[0])) from e
|