Parses a Json object node and returns the DataError corresponding to it.
It is up to the client to make sure that the object node is a DataError
representation. Any unrecognized elements are ignored.
335736
public static DataError fromJson(ObjectNode node) {
        DataError error = new DataError();
        JsonNode x = node.get("data");
        if (x != null) {
            error.entityData = x;
        }
        x = node.get("errors");
        if (x instanceof ArrayNode) {
            error.errors = new ArrayList<>();
            for (Iterator<JsonNode> itr = ((ArrayNode) x).elements();
                    itr.hasNext();) {
                error.errors.add(Error.fromJson(itr.next()));
            }
        }
        return error;
    }
288278
async def parse_response(response: ClientResponse, schema: dict) -> Any:
    
    try:
        data = await response.json()
        response.close()
        if schema is not None:
            jsonschema.validate(data, schema)
        return data
    except (TypeError, json.decoder.JSONDecodeError) as e:
        raise jsonschema.ValidationError("Could not parse json : {0}".format(str(e)))
302879
function parseMessage(dataString) {
		/*eslint no-empty: 0*/
		var data;
		if (typeof dataString !== 'string') {
			return;
		}

		try {
			data = JSON.parse(dataString);
		} catch (ex) {}

		if (!verify(data)) {
			return;
		}

		if (typeof data.error === 'object') {
			data.error = buildErrorObject(data.error);
		} else {
			data.error = undefined;
		}
		return data;
	}
595942
private JsonElement parse(JsonElement element, JsonSchema schema)
      throws DataConversionException {
    JsonObject root = new JsonObject();
    root.add(DEFAULT_RECORD_COLUMN_NAME, element);
    JsonObject jsonObject = parse(root, schema);
    return jsonObject.get(DEFAULT_RECORD_COLUMN_NAME);
  }
947868
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
        jsonObject = Utils.mapper().readValue((DataInput) stream, ObjectNode.class);
    }
1156254
function parseJSON(body, callback) {
  let r = null;
  let err = null;

  try {
    if (typeof body === 'string') {
      r = JSON.parse(body);
    } else {
      r = body;
    }
  } catch(e) {
    err = e;
  }

  return callback(err, r);
}
1193675
public static DataError findErrorForDoc(List<DataError> list, JsonNode node) {
        for (DataError x : list) {
            if (x.entityData == node) {
                return x;
            }
        }
        return null;
    }
40590
def _parse_error_tree(error):
    
    errinf = ErrorInfo(error.get('id'), None)
    if error.text is not None:
        errinf.message = error.text
    else:
        desc = error.find('./desc')
        if desc is not None:
            errinf.message = desc.text
    return errinf
768995
function parseJSON(data) {
    var oData;
    try {
        oData = JSON.parse(data);
    } catch (e) {
        return false;
    }
    return oData;
}
1048676
function parse(node) {
    const cfg = Object.assign({}, copyXmlAttributes(node));

    for (let i = 0, l = node.childNodes.length; i < l; ++i) {
        const el = node.childNodes.item(i);
        if (el.nodeType === ELEMENT_NODE) {
            if (!el.namespaceURI) {
                // attribute elements
                if (!cfg.attributes) cfg.attributes = {};
                cfg.attributes[el.localName] = el.childNodes.length ? parse(el) : copyXmlAttributes(el);
            } else if (el.namespaceURI === 'urn:flora:options') {
                // flora specific elements
                if (el.localName === 'dataSource') {
                    const dataSource = getDataSource(el);
                    if (!cfg.dataSources) cfg.dataSources = {};
                    if (cfg.dataSources[dataSource.name]) {
                        throw new Error(`Data source "${dataSource.name}" already defined`);
                    }
                    cfg.dataSources[dataSource.name] = dataSource.config;
                }
                if (el.localName === 'subFilter') {
                    if (!cfg.subFilters) cfg.subFilters = [];
                    cfg.subFilters.push(copyXmlAttributes(el));
                }
            }
        } else if (el.nodeType === TEXT_NODE && el.textContent.trim().length > 0) {
            throw new ImplementationError(`Config contains unnecessary text: "${el.textContent.trim()}"`);
        }
    }

    return cfg;
}
322839
public String getJsonError(ODataException exception) throws ODataRenderException {
        checkNotNull(exception);

        LOG.debug("Start building Json error document");

        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

        try {
            JsonGenerator jsonGenerator = JSON_FACTORY.createGenerator(outputStream, JsonEncoding.UTF8);
            jsonGenerator.writeStartObject();

            jsonGenerator.writeObjectFieldStart(ERROR);

            jsonGenerator.writeStringField(CODE, String.valueOf(exception.getCode().getCode()));
            jsonGenerator.writeStringField(MESSAGE, String.valueOf(exception.getMessage()));
            // optional
            if (exception.getTarget() != null) {
                jsonGenerator.writeStringField(TARGET, String.valueOf(exception.getTarget()).replace("\"", "'"));
            }
            jsonGenerator.writeEndObject();
            jsonGenerator.close();

            return outputStream.toString();
        } catch (IOException e) {
            LOG.error("Not possible to write error JSON.");
            throw new ODataRenderException("Not possible to write error JSON: ", e);
        }
    }
828458
private static DataNode marshalObject(Map<String, AbstractDataMarshaller<?>> marshallerMap, Object object) {
        //can't be null here because it is not resolved: meaning, it is an instance of an unknown class
        final Class<?> clazz = object.getClass();

        final AbstractDataMarshaller<Object> serializer = (AbstractDataMarshaller<Object>) marshallerMap.get(clazz.getCanonicalName());
        if (serializer != null) {
            final DataNode node = serializer.marshal(object);
            node.setObject(META_CLASS_NAME, serializer.getDataClassName());
            return node;
        }
        return null; //no marshaller - let others decide what to do with that info
    }
628586
protected void checkForStandardGraphError(JsonNode node) {
		JsonNode errorNode = node.get("error");
		if (errorNode != null) {
			// If we're missing type or message, it must be some other kind of error
			String type = errorNode.path("type").textValue();
			if (type == null)
				return;
			
			String msg = errorNode.path("message").textValue();
			if (msg == null)
				return;

			JsonNode codeNode = errorNode.get("code");
			Integer code = codeNode == null ? null : codeNode.intValue();

			JsonNode subcodeNode = errorNode.get("error_subcode");
			Integer subcode = subcodeNode == null ? null : subcodeNode.intValue();

			String userTitle = errorNode.path("error_user_title").textValue();
			String userMsg = errorNode.path("error_user_msg").textValue();

			if (code != null) {
				// Special case, migration exceptions are poorly structured
				if (code == 21)
					this.throwPageMigratedException(msg, code, subcode, userTitle, userMsg);

				// Documented here: https://developers.facebook.com/docs/graph-api/using-graph-api
				if (code == 10 || (code >= 200 && code <= 299))
					throw new PermissionException(msg, type, code, subcode, userTitle, userMsg);
			}

			// We check to see if we have an exception that matches the type, otherwise
			// we simply throw the base FacebookException
			String proposedExceptionType = Batcher.class.getPackage().getName() + ".err." + type;
			
			try {
				Class<?> exceptionClass = Class.forName(proposedExceptionType);
				Constructor<?> ctor = exceptionClass.getConstructor(String.class, String.class, Integer.TYPE, Integer.TYPE);
				throw (FacebookException)ctor.newInstance(msg, type, code, subcode);
			} catch (FacebookException e) {
				throw e;
			} catch (Exception e) {
				throw new ErrorFacebookException(type + ": " + msg, type, code, subcode, userTitle, userMsg);
			}
		}
	}
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
}
216868
private int parseObject() throws Exception {
        int elementsWritten = 0;
        while (jsonParser.nextToken() != null && jsonParser.getCurrentToken() != END_OBJECT) {
            if (FIELD_NAME.equals(jsonParser.getCurrentToken())) {
                String elementName = convertName(jsonParser.getCurrentName());
                //jump to element value
                jsonParser.nextToken();
                startElement(elementName);
                parseElement(elementName, false);
                endElement(elementName);
                elementsWritten++;
            } else {
                throw new ParserException("Error when parsing. Expected field name got " + jsonParser.getCurrentToken());
            }
        }
        return elementsWritten;
    }
638203
def _parse(cls, data, key=None):
        
        parse = cls.parse if cls.parse is not None else cls.get_endpoint()

        if callable(parse):
            data = parse(data)
        elif isinstance(parse, str):
            data = data[key]
        else:
            raise Exception('"parse" should be a callable or string got, {0}'
                            .format(parse))
        return data
234099
def __parse_json_data(self, data):
        
        if isinstance(data, dict) or isinstance(data, list):
            self._raw_data = data
            self._json_data = copy.deepcopy(self._raw_data)
        else:
            raise TypeError("Provided Data is not json")