Code example for JsonParser

Methods: parse

0
 
		String responseStr;
		responseStr = IOUtils.toString(callConnection.getInputStream());
		callConnection.disconnect();
 
		JsonParser jp = new JsonParser();
		return jp.parse(responseStr);
	} 
 
	public static double[][] getGeometryForArea(Area area)
			throws XPathExpressionException, ParserConfigurationException, 
			SAXException, IOException, NDE2Exception, Exception { 
		JsonElement _root = getJson(area.getDetailed().getExtCode());
		JsonObject geojson = _root.getAsJsonObject();
		JsonArray coord_ja = geojson.get("coordinates").getAsJsonArray().get(0)
				.getAsJsonArray();
		double[][] coords = new double[coord_ja.size()][2];
		for (int i = 0; i < coord_ja.size(); i++) {
			JsonArray jsonCoordPair = coord_ja.get(i).getAsJsonArray();
			coords[i][0] = jsonCoordPair.get(0).getAsDouble();