@allow_cross_site_request
@non_atomic_requests
def render_json(request, addon, stats):
    response = http.HttpResponse(content_type='text/json')

    # XXX: Subclass DjangoJSONEncoder to handle generators.
    if isinstance(stats, GeneratorType):
        stats = list(stats)

    # Django's encoder supports date and datetime.
    fudge_headers(response, stats)
    json.dump(stats, response, cls=DecimalJSONEncoder)
    return response
Render a stats series in JSON.
dataset/ETHPy150Open mozilla/addons-server/src/olympia/stats/views.py/render_json