JSON parse with error
@param  {String} data
@return {String|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;
}
9139
def validate_json(data: str):
    
    result = None
    try:
        result = json.loads(data)
    except ValueError as error:
        log(ERROR, "invalid json: %s", error)

    return result
572901
public function error($msg = null, $data = null, $extraData = [])
    {
        $return = $this->output(0, $msg, $data, $extraData);

        return $this->responseJson($return);
    }
538683
private function getErrorFromRegData($data)
	{
		$data['username'] = e($data['username']);
		$validator = Validator::make($data, Validators::rulesForRegisterAcc(), Validators::messagesForErrors());
		$userMessages = $validator->messages();

		if ($validator->fails()) {
			$result['errors'] = array(
				'username'        => $userMessages->first('username'),
				'callback'        => $userMessages->first('callback'),
				'email'           => $userMessages->first('email'),
				'password'        => $userMessages->first('password'),
				'confirmPassword' => $userMessages->first('confirmPassword'),
			);

			return $result;
		}

		return null;
	}
697597
function(data) {
        var ret = null; 
        
        if (!data) {
            ret = (this.response.error !== '');
        } else {
            data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
            var errorNodes = data.documentElement.getElementsByTagName("ERROR");
            ret = (errorNodes !== null && errorNodes.length > 0);
        }

        return ret;
    }
1197263
function(oData) {
    // Special case null and undefined
    if(!lang.isValue(oData)) {
        return null;
    }
    
    //Convert to string
    var string = oData + "";

    // Validate
    if(lang.isString(string)) {
        return string;
    }
    else {
        YAHOO.log("Could not convert data " + lang.dump(oData) + " to type String", "warn", this.toString());
        return null;
    }
}
368909
function tryFormat(body) {
  try {
    const parsed = typeof body === 'string' ? JSON.parse(body) : body
    return JSON.stringify(parsed, null, 2)
  } catch (err) {
    return body
  }
}
1059032
function formatError(e) {
  if (!e.err) return e.message;
  if (e.err.message) return e.err.message;
  return JSON.stringify(e.err);
}
723380
public static <T extends Errors> T parseError(ObjectMapper mapper, JsonNode errorResponse, Class<T> cls) throws JsonProcessingException {
        return mapper.treeToValue(errorResponse, cls);
    }
937258
def parse(self, data):
        ''''''
        self.field_errors = {}
        return dict(
            (k, self._parse_value(k, v)) for k, v in data.items()
        )
1242670
function parseError(e) {
  if(e.ns === 'STORE.REDIS') return true;
  if(e.code && e.code.indexOf('REDIS') === 0) {
    e.ns = 'STORE.REDIS';
    return true;
  }
}
1088394
function (body, next) {
                parseString(body, function (err, json) {
                    if (err) {
                        return next(err);
                    }
                    next(null, json);
                });
            }
1294200
function (err, data) {
      debug(`${service}.${method} response:`, err || {
        status: data && data.status,
        size: data && JSON.stringify(data).length
      });
      if (err) return next(err.cause || err);

      res.data = data;

      if (!data) {
        debug(`No content returned for '${req.url}'`);
        res.status(statusCodes.noContent);
      } else if (method === 'create') {
        res.status(statusCodes.created);
      }

      return next();
    }
937831
function(data, dontParse) {
    // grunt.file chokes on objects, so we check for it immiedietly
    if (typeof data === 'object') {
      return data;
    }

    // `data` isn't an object, so its probably a file
    try {
      // alce allows us to parse single-quote JSON (which is tehcnically invalid, and thereby chokes JSON.parse)
      data = grunt.file.read(data);
      if (!dontParse) {
        data = alce.parse(data);
      }
    }
    catch (e) {}

    return data;
  }
1291564
function(oData) {
    // Special case null and undefined
    if(!lang.isValue(oData)) {
        return null;
    }
    
    //Convert to string
    var string = oData + "";

    // Validate
    if(lang.isString(string)) {
        return string;
    }
    else {
        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;
    }
668089
function onError (data) {
    var map = sourceMap.map()
    var error
    var smc

    if (!data.length) {
      return
    }

    // if what we get isn't json, it's some other undescribed phantom error;
    // just echo it.
    try {
      error = JSON.parse(data.toString())
    } catch (e) {
      io.stderr.write(sprintf('\n\n%s\n', data.toString()))

      return
    }

    // if a source map wasn't present, just output the line numbers where an
    // error occurred
    if (!map) {
      io.stderr.write(sprintf('\n\n%s\n', error.message))

      if (error.trace && error.trace.length) {
        error.trace.forEach(function (e) {
          io.stderr.write(sprintf('    at :%d', e.line))

          if (e.function) {
            io.stderr.write(sprintf(' (in function %s)', e.function))
          }

          io.stderr.write('\n')
        })
      }

      return
    }

    // else, make sense of the sourcemap and output that information
    smc = new Consumer(map)

    io.stderr.write(sprintf('\n\n%s\n', error.message))

    if (error.trace && error.trace.length) {
      error.trace.forEach(function (e) {
        if (!e.line) {
          return
        }

        // phantom doesn't provide columns in stack traces
        var err = smc.originalPositionFor(
            {line: e.line, column: e.column || 0}
        )

        io.stderr.write(sprintf('    at %s:%d\n', err.source, err.line))
      })
    }
  }