Moved JsonDebugPrinter to existing utils module

This commit is contained in:
Chuddah 2020-02-22 15:04:28 +00:00
parent 7491000a13
commit de493d13dd
6 changed files with 25 additions and 24 deletions

View file

@ -494,3 +494,16 @@ def has_attribute(obj, name):
return True
except AttributeError:
return False
class JsonDebugPrinter(object):
''' Helper class to defer converting data to JSON until it is needed.
See: https://github.com/jellyfin/jellyfin-kodi/pull/193
'''
def __init__(self, data):
self.data = data
def __str__(self):
return json.dumps(self.data, indent=4)