mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-24 22:58:46 +01:00
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.
13 lines
270 B
Python
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)
|