Parse JSON middleware

@param {String} msg
976944
function parseMiddleware(ctx, next) {
      try {
        ctx.event = JSON.parse(ctx.content.toString());
        next();
      } catch (e) {
        throw e;
      }
    }
982385
public static function decode($msg)
    {
        try {
            $data = json_decode($msg, true);

            return $data;
        } catch (\Exception $e) {
            throw new \InvalidArgumentException('Invalid json format');
        }
    }
137518
public RequestContext renderMsg(final String msg) {
        if (renderer instanceof JsonRenderer) {
            final JsonRenderer r = (JsonRenderer) renderer;

            final JSONObject ret = r.getJSONObject();
            ret.put(Keys.MSG, msg);
        }

        return this;
    }
698135
function parseResponse(event) {
            try {
                var response = JSON.parse(event.data);

                // Check for success key to ignore messages being sent
                if (response.namespace === namespace && typeof response.success === 'boolean') {
                    return response;
                }

                return false;
            } catch (e) {}

            return false;
        }
1083094
function (msg, knownComputations) {
    if (msg.data && msg.data.byteLength) {
      // The presence of byteLength indicates data is an ArrayBuffer from a WebSocket data frame.
      return parseBinaryMessage(msg.data, knownComputations);
    } else if (msg.type) {
      // Otherwise it's JSON in a WebSocket text frame.
      return JSON.parse(msg.data);
    } else {
      console.warn('Unrecognized websocket message.');
      return null;
    }
  }
377192
function tryParseJson(text) {
        text = _.trim(text);
        if ((_.startsWith(text, "[") && _.endsWith(text, "]")) || (_.startsWith(text, "{") && _.endsWith(text, "}"))) {
            try {
                return JSON.parse(text);
            }
            catch (e) {
                // ignore
            }
        }
        return null;
    }
907042
function _jsonParse(body) {
  let json = ''
  try {
    json = typeof body === 'object' ? body : JSON.parse(body)
  } catch (e) {
    throw new Error(
      'Error parsing JSON string: ' + e.message + '\n\tGiven: ' + body
    )
  }
  return json
}
694592
function parse(msg) {
  let model;
  if (typeof msg === 'object') {
    // data is a MessageEvent not a raw string
    msg = msg.data;
  }

  if (msg.startsWith(PullMessage.TYPE)) {
    // pull
    return new PullMessage();
  }

  if (msg.startsWith(RegisteredMessage.TYPE)) {
    // registered ack
    return new RegisteredMessage();
  }

  if (msg.startsWith(PushMessage.TYPE + '/')) {
    // push/modelStr
    model = msg.substring(PushMessage.TYPE.length + 1);
    return new PushMessage(model);
  }

  if (msg.startsWith(PushKevSMessage.TYPE + '/')) {
    // push/kevsStr
    model = msg.substring(PushKevSMessage.TYPE.length + 1);
    return new PushKevSMessage(model);
  }

  if (msg.startsWith(RegisterMessage.TYPE)) {
    // register/nodeName/modelStr
    const payload = msg.substring(RegisterMessage.TYPE.length + 1);
    let index = 0;
    let ch = payload.charAt(index);
    while (index < payload.length && ch !== '/') {
      index++;
      ch = payload[index];
    }
    const nodeName = payload.substring(0, index);
    return new RegisterMessage(nodeName, payload.substring(index + 1));
  }

  return null;
}
336254
function parse(data) {
  try {
    return JSON.parse(data);
  } catch (e) {
    log('Oops! Some problems parsing this ' + (typeof data === 'undefined' ? 'undefined' : _typeof(data)) + '.', 'error', debug);
  }

  return null;
}
465069
def parse(response):
        """"""
        if response.status_code == 400:
            try:
                msg = json.loads(response.content)['message']
            except (KeyError, ValueError):
                msg = ''
            raise ApiError(msg)
        return response
980240
public function parseServerFinalMessage($msg)
    {
        foreach (explode(',', $msg) as $val) {
            list($attr, $aval) = array_map('trim', explode('=', $val, 2));

            switch ($attr) {
            case 'e':
                return false;

            case 'v':
                return (base64_decode($aval) === $this->_serversig);
            }
        }

        return false;
    }
483466
function handle(msg) {
  log.debug('handling msg', msg)
  var to = msg.to,
    intent = msg.intent;
  if (to && intent) {
    var reply;
    // try JSON or JSON.input as input
    try {
      reply = _.get(lib_js[to], intent)(msg)
    } catch (err) {
      try {
        reply = _.get(lib_js[to], intent)(msg.input)
      } catch (deepErr) {
        log.debug('js handle fails.', deepErr)
      }
    } finally {
      // try JSON or made-JSON output
      reply = correctReply(reply, msg)
      log.debug('reply', reply)
      if (reply.to) {
        client.emit('pass', reply)
      }
    }
  }
}
1269196
def _parse_json(s):
    '''
    
    '''
    return json.loads(s, object_hook=lambda pairs: JsonDict(pairs.iteritems()))
562751
private ObjectJS jsonMessage(String message, StringifierFactory jsonStringifierFactory) {
		ObjectJS timelineJS = new ObjectJS();
		timelineJS.setSimpleAttribute("message", message, jsonStringifierFactory.getStringifier(String.class));
		return timelineJS;
	}
1335272
function (message) {
    var objs = [], collector = '', chr, msglen, data;

    this.data += message;
    data = new Buffer(this.data, 'utf8');

    for (var i = 0; i < data.length; i += 1) {
        chr = data[i];
        if (chr > 47 && chr < 58) {
            collector += String.fromCharCode(chr);
        } else if (chr !== 10 && chr !== 13) {
            msglen = parseInt(collector, 10);

            if (msglen + i <= data.length) {
              objs.push(JSON.parse(data.toString('utf8', i, msglen + i)));
              data = data.slice(i + msglen);
              collector = '';
              i = 0;
            } else {
              break;
            }
        }
    }
    this.data = data.toString('utf8');
    return objs;
}
127977
static function message($msg)
    {
        $msg = empty($msg) ? '' : $msg;

        if(!is_string($msg)) {
            $msg = json_encode($msg);
        }

        echo $msg;

        return true;
    }
1199542
function getRecordUpdateData (msg) {
  let data

  try {
    data = JSON.parse(msg.data[2])
  } catch (error) {
    return error
  }

  return data
}