lnbits-legend/lnbits/helpers.py
Eneko Illarramendi 0d33bc2933 refactor: remove databases from code an use schemas instead
All databases are now saved together in the same LNBITS_DATA_FOLDER.
Extensions have to define a schema.yml file for creating the necessary database.
2020-02-10 19:40:01 +01:00

13 lines
270 B
Python

import json
import sqlite3
class MegaEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, sqlite3.Row):
return {k: obj[k] for k in obj.keys()}
return obj
def megajson(obj):
return json.dumps(obj, cls=MegaEncoder)