private void filter(JSONObject o) throws JSONException {
		Iterator ji = o.keys();
		while (ji.hasNext()) {
			String key = (String) ji.next();
			Object val = o.get(key);
			if (val.getClass() == JSONObject.class) {
				if (!firstCall) {
					index++;
					Element e = new Element(key);
					tree.add(index, e);

					filter((JSONObject) val);
					index--;
					tree.get(index).addContent(e);
				} else {
					firstCall = false;
					Element e = new Element(key);
					tree.add(index, e);
					filter((JSONObject) val);
				}
			} else if (val.getClass() == JSONArray.class) {
				List<Object> l = new ArrayList<Object>();
				JSONArray arr = (JSONArray) val;

				for (int a = 0; a < (arr).length(); a++) {
					Object element;
					element = arr.get(a);
					index++;
					Element e = new Element(key);
					tree.add(index, e);
					if (element instanceof JSONObject) {
						filter((JSONObject) element);
					} else {
						Element e2 = new Element(key);
						e2.addContent(val.toString());
						tree.get(index).addContent(e2);
						l.add(element);
					}
					index--;
					tree.get(index).addContent(e);
				}
			} else {
				Element e = new Element(key);
				e.addContent(val.toString());
				tree.get(index).addContent(e);
			}
		}
	}