MCPcopy Create free account
hub / github.com/alephdata/aleph / jsonify

Function jsonify

aleph/views/util.py:143–153  ·  view source on GitHub ↗

Serialize to JSON and also dump from the given schema.

(obj, status=200, headers=None, encoder=JSONEncoder)

Source from the content-addressed store, hash-verified

141
142
143def jsonify(obj, status=200, headers=None, encoder=JSONEncoder):
144 """Serialize to JSON and also dump from the given schema."""
145 data = encoder().encode(obj)
146 mimetype = "application/json"
147 if "callback" in request.args:
148 cb = request.args.get("callback")
149 cb = "".join((c for c in cb if c in CALLBACK_VALID))
150 data = "%s && %s(%s)" % (cb, cb, data)
151 # mime cf. https://stackoverflow.com/questions/24528211/
152 mimetype = "application/javascript"
153 return Response(data, headers=headers, status=status, mimetype=mimetype)
154
155
156def stream_ijson(iterable, encoder=JSONEncoder):

Callers 15

statusFunction · 0.90
reconcile_indexFunction · 0.90
reconcileFunction · 0.90
suggest_entityFunction · 0.90
suggest_propertyFunction · 0.90
suggest_typeFunction · 0.90
jsonifyMethod · 0.90
jsonify_resultMethod · 0.90
generateFunction · 0.90
indexFunction · 0.90
metadataFunction · 0.90
openapiFunction · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected