[PYTHON] Returns json in Pyramid

Returns json in Pyramid View.

from pyramid.view import Response
from pyramid.view import view_config

@view_config(route_name='json')
def func(request):
  body = u'''
{{
"key": "value"
}}
  '''
  return Response(body=body, headerlist=[('Content-Type', 'application/json')])

It will be returned using the Response class.

Recommended Posts

Returns json in Pyramid
Handling json in python
zipimporter error in pyramid
Easily format JSON in Python
Display Japanese in JSON file
Export DB data in json format
Handling of JSON files in Python
pyramid
json
json
Data input / output in Python (CSV, JSON)
Create a JSON object mapper in Python
Implement a custom View Decorator in Pyramid
Read and write JSON files in Python
scipy.sparse.linalg.svds returns singular values in ascending order