def output_json(data, code, headers=None):
 settings = current_app.config.get('RESTFUL_JSON', {})
 if current_app.debug:
  settings.setdefault('indent', 4)
  settings.setdefault('sort_keys', True)
 dumped = (dumps(data, **settings) + '\n')
 resp = make_response(dumped, code)
 resp.headers.extend((headers or {}))
 return resp

def output_json ( data , code , headers = None ) : settings = current_app . config . get ( 'RESTFUL_JSON' , { } ) if current_app . debug : settings . setdefault ( 'indent' , 4 ) settings . setdefault ( 'sort_keys' , True ) dumped = ( dumps ( data , ** settings ) + '\n' ) resp = make_response ( dumped , code ) resp . headers . extend ( ( headers or { } ) ) return resp
makes a flask response with a json encoded body .