:param dict j: JSON response from TryHaskell.
        :rtype: TryHaskell.Result
6801
def parse(cls, j):
        
        error = j.get('error')
        if error:
            return cls._bad_result(error)
        success = j.get('success')
        if success:
            try:
                return cls.Result(ok=True, **j.get('success'))
            except (TypeError, ValueError) as e:
                raise cls.Error(e)
        # If there was neither a success nor an error, the service
        # is probably expecting something from stdin, which is not
        # currently implemented.
        # TODO: Implement stdin.
        return cls._bad_result('Unsupported operation.')
879663
def get_object(
        self, object_t, object_id=None, relation=None, parent=None, **kwargs
    ):
        
        url = self.object_url(object_t, object_id, relation, **kwargs)
        logging.debug(url)
        response = yield self._async_client.fetch(url)
        resp_str = response.body.decode("utf-8")
        jsn = json.loads(resp_str)
        result = self._process_json(jsn, parent)
        raise Return(result)
7442
def __obj2json(self, obj):
        
        return json.dumps(obj, indent=self._indent, sort_keys=self._sort_keys)
263885
def _jsTypeof(o):
    ''''''
    if o == None:
        return 'object'
    elif o == Undefined:
        return 'undefined'
    elif isinstance(o, bool):
        return 'boolean'
    if isinstance(o, int) or isinstance(o, float):
        return 'number'
    elif isinstance(o, list) or isinstance(o, dict):
        return 'object'
    elif isinstance(o, stringtype):
        return 'string'
    raise ValueError('Unknown type for object %s (%s)' % (o, type(o)))
1203653
def get(self, key):
        
        data = r_kv.get(key)
        # data = json.dumps(data) if isinstance(data, str) else data
        # data = json.loads(data) if data else {}

        return build_response(dict(data=data, code=200))
967885
def result_or_error(response):
    
    data = response.json()
    result = data.get('result')
    if result is not None:
        return result
    raise exceptions.ApiError(response, data)
1369978
def json_success(self, json):
        
        if type(json) is dict and 'result' in json and json['result'] == 'success':
            return True
        return False
1552
def jsonp(*args, **kw):
    
    data = json.dumps(dict(*args, **kw), indent=2)
    callback = request.args.get('callback', request.args.get('jsonp'))
    if callback and __jsoncallback_re.search(callback) is not None:
        data = callback + u'(' + data + u');'
        mimetype = 'application/javascript'
    else:
        mimetype = 'application/json'
    return Response(data, mimetype=mimetype)
737477
def from_json(cls, s):
        
        d = json.loads(s)
        return get_dict_handler(d["type"])(d)
1332925
def J(*args, **kwargs):
    
    response = jsonify(*args, **kwargs)
    response.mimetype = 'application/vnd.api+json'
    return response
1203828
def from_response(response, body):
    
    if isinstance(response, dict):
        status = response.get("status_code")
    else:
        status = response.status_code
    cls = _code_map.get(int(status), ClientException)

#    import pyrax
#    pyrax.utils.trace()

    request_id = response.headers.get("x-compute-request-id")
    if body:
        message = "n/a"
        details = "n/a"
        if isinstance(body, dict):
            message = body.get("message")
            details = body.get("details")
            if message is details is None:
                error = body[next(iter(body))]
                if isinstance(error, dict):
                    message = error.get("message", None)
                    details = error.get("details", None)
                else:
                    message = error
                    details = None
        else:
            message = body
        return cls(code=status, message=message, details=details,
                   request_id=request_id)
    else:
        return cls(code=status, request_id=request_id)
274725
def pprint(j, no_pretty):
    
    if not no_pretty:
        click.echo(
            json.dumps(j, cls=PotionJSONEncoder, sort_keys=True, indent=4, separators=(",", ": "))
        )
    else:
        click.echo(j)
453251
def render_json_response(self, context_dict, status=200):
        
        json_context = json.dumps(
            context_dict,
            cls=DjangoJSONEncoder,
            **self.get_json_dumps_kwargs()
        ).encode(u'utf-8')
        return HttpResponse(
            json_context,
            content_type=self.get_content_type(),
            status=status
        )
1337101
async def jsk_python(self, ctx: commands.Context, *, argument: CodeblockConverter):
        

        arg_dict = get_var_dict_from_ctx(ctx, SCOPE_PREFIX)
        arg_dict["_"] = self.last_result

        scope = self.scope

        try:
            async with ReplResponseReactor(ctx.message):
                with self.submit(ctx):
                    async for result in AsyncCodeExecutor(argument.content, scope, arg_dict=arg_dict):
                        if result is None:
                            continue

                        self.last_result = result

                        if isinstance(result, discord.File):
                            await ctx.send(file=result)
                        elif isinstance(result, discord.Embed):
                            await ctx.send(embed=result)
                        elif isinstance(result, PaginatorInterface):
                            await result.send_to(ctx)
                        else:
                            if not isinstance(result, str):
                                # repr all non-strings
                                result = repr(result)

                            if len(result) > 2000:
                                # inconsistency here, results get wrapped in codeblocks when they are too large
                                #  but don't if they're not. probably not that bad, but noting for later review
                                paginator = WrappedPaginator(prefix='```py', suffix='```', max_size=1985)

                                paginator.add_line(result)

                                interface = PaginatorInterface(ctx.bot, paginator, owner=ctx.author)
                                await interface.send_to(ctx)
                            else:
                                if result.strip() == '':
                                    result = "\u200b"

                                await ctx.send(result.replace(self.bot.http.token, "[token omitted]"))
        finally:
            scope.clear_intersection(arg_dict)
9772
def _json_convert(obj, json_options=DEFAULT_JSON_OPTIONS):
    
    if hasattr(obj, 'iteritems') or hasattr(obj, 'items'):  # PY3 support
        return SON(((k, _json_convert(v, json_options))
                    for k, v in iteritems(obj)))
    elif hasattr(obj, '__iter__') and not isinstance(obj, (text_type, bytes)):
        return list((_json_convert(v, json_options) for v in obj))
    try:
        return default(obj, json_options)
    except TypeError:
        return obj
512158
def call(self, method, **params):
        
        url = self.api_url % method
        request = self._get_request(url, self.METHODS[method], **params)
        try:
            response = urlopen(request)
        except URLError:
            raise
        else:
            response_json = json.loads(response.read())
            if not response_json['succeeded']:
                raise DisqusException(response_json['message'])
            return response_json['message']
1094066
def _json(self, response):
        
        if response.status_code == 204:
            return None
        try:
            return response.json()
        except ValueError as e:
            raise ValueError(
                'Exception: %s\n'
                'request: %s, response code: %s, response: %s' % (
                    str(e), response.request.url, response.status_code,
                    response.content,
                )
            )