We need this until we can get json back directly and this is SUPER nasty
182698
def decodeIlxResp(resp):
    
    lines = [_ for _ in resp.text.split('\n') if _]  # strip empties

    if 'successfull' in lines[0]:
        return [(_.split('"')[1],
                 ilxIdFix(_.split(': ')[-1]))
                for _ in lines[1:]]
    elif 'errors' in lines[0]:
        return [(_.split('"')[1],
                 ilxIdFix(_.split('(')[1].split(')')[0]))
                for _ in lines[1:]]
698919
public JSONObject toJSON() {
        JSONObject ret = new JSONObject();
        ret.put("url", url);
        if (env != null) {
            ret.put("env", env);
        }
        return ret;
    }
1059076
def refresh
      json = JSON(Net::HTTP.get(URI.parse(base_url)))
      unpack(json)
    end
91152
async def get_json(self, url, timeout=30, astext=False, exceptions=False):
        """"""
        try:
            with async_timeout.timeout(timeout):
                res = await self._aio_session.get(url)
                if res.status != 200:
                    _LOGGER.error("QSUSB returned %s [%s]", res.status, url)
                    return None
                res_text = await res.text()
        except (aiohttp.client_exceptions.ClientError,
                asyncio.TimeoutError) as exc:
            if exceptions:
                raise exc
            return None

        if astext:
            return res_text

        try:
            return json.loads(res_text)
        except json.decoder.JSONDecodeError:
            if res_text.strip(" ") == "":
                return None
            _LOGGER.error("Could not decode %s [%s]", res_text, url)
1251310
public function remakeJson()
    {
        $json = json_encode([
            'last_remote_check' => (!is_null($this->lastRemoteCheck) ? $this->lastRemoteCheck->timestamp : null),
            'hooks'             => $this->hooks(),
        ], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);

        file_put_contents(base_path('hooks/hooks.json'), $json);
    }
748235
def install_json(self):
        """"""
        if self._install_json is None:
            try:
                install_json_filename = os.path.join(os.getcwd(), 'install.json')
                with open(install_json_filename, 'r') as fh:
                    self._install_json = json.load(fh)
            except IOError:
                self.log.warning(u'Could not retrieve App Data.')
                self._install_json = {}
        return self._install_json
170003
def get_json(self, timeout):
        
        (action, msg, kwargs) = yield from self.get(timeout)
        if hasattr(msg, "__json__"):
            msg = {"action": action, "event": msg.__json__()}
        else:
            msg = {"action": action, "event": msg}
        msg.update(kwargs)
        return json.dumps(msg, sort_keys=True)
884206
function _response_json_fail(res, envl, message){
    envl.status('failure');
    envl.comments(message);
    return res.json(envl.structure());
}
1211656
private function getLastJsonError()
    {
        static $messages = [
            JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
            JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch',
            JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
            JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON',
            JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded',
        ];
        $jsonLastError = json_last_error();

        return array_key_exists($jsonLastError, $messages) ? $messages[$jsonLastError] : 'Empty response received';
    }
94066
def replace_with_json(self, json):
        ''' 

        '''
        replacement = self.from_json(json)
        replacement._destructively_move(self)
1080318
function() {
        "use strict";
        var ret = "";
        if (this.json.length > 0) {
            if (this.json.length === 1) {
                ret = JSON.stringify(this.json[0]);
            } else {
                ret = JSON.stringify(this.json);
            }
        }
        return ret;
    }
213273
def json(self):
        """"""

        if not self.headers and len(self.content) > 3:
            encoding = get_encoding_from_headers(self.headers)
            if encoding is not None:
                return json.loads(self.content.decode(encoding))
        return json.loads(self.content)
1330794
public function wantsJson()
    {
        $acceptable = $this->getAcceptableContentTypes();
        return (isset($acceptable[0]) && (strpos($acceptable[0], '/json') !== false || strpos($acceptable[0], '+json') !== false));
    }
57763
function toJSON() {
    var s = this;
    var values = Object.assign({}, s.schema);
    Object.keys(values).forEach(function (key) {
      var isFunc = iftype.isFunction(values[key]);

      if (isFunc) {
        delete values[key];
      }
    });
    return values;
  }
1291879
def _get_json(self, urlpart):
        
        url = self._url + "/%s" % urlpart
        params = {
            "f" : "json",

        }
        return self._get(url=url,
                            param_dict=params,
                            securityHandler=self._securityHandler,
                            proxy_url=self._proxy_url,
                            proxy_port=self.proxy_port)
65582
def json(self):
        '''  '''
        if 'application/json' in self.environ.get('CONTENT_TYPE', '') \
        and 0 < self.content_length < self.MEMFILE_MAX:
            return json_loads(self.body.read(self.MEMFILE_MAX))
        return None
1137418
def json(self, *,  # type: ignore
             loads: Callable[[Any], Any]=json.loads) -> None:
        
        return loads(self.data)