MCPcopy Create free account
hub / github.com/piccolo-orm/piccolo / JSONDict

Class JSONDict

piccolo/utils/encoding.py:32–63  ·  view source on GitHub ↗

Once we have parsed a JSON string into a dictionary, we can't distinguish it from other dictionaries. Sometimes we might want to - for example:: >>> await Album.select( ... Album.all_columns(), ... Album.recording_studio.all_columns() ... ).outp

Source from the content-addressed store, hash-verified

30
31
32class JSONDict(dict):
33 """
34 Once we have parsed a JSON string into a dictionary, we can't distinguish
35 it from other dictionaries.
36
37 Sometimes we might want to - for example::
38
39 >>> await Album.select(
40 ... Album.all_columns(),
41 ... Album.recording_studio.all_columns()
42 ... ).output(
43 ... nested=True,
44 ... load_json=True
45 ... )
46
47 [{
48 'id': 1,
49 'band': 1,
50 'name': 'Awesome album 1',
51 'recorded_at': {
52 'id': 1,
53 'facilities': {'restaurant': True, 'mixing_desk': True},
54 'name': 'Abbey Road'
55 },
56 'release_date': datetime.date(2021, 1, 1)
57 }]
58
59 Facilities could be mistaken for a table.
60
61 """
62
63 ...
64
65
66def load_json(data: str) -> Any:

Callers 1

load_jsonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected