List of usage examples for org.json.simple JSONObject get
V get(Object key);
From source file:de.ingrid.external.gemet.JSONUtils.java
public static String getName(JSONObject json) { return (String) ((JSONObject) json.get("preferredLabel")).get("string"); }
From source file:mml.DocType.java
public static DocType classifyObj(JSONObject jObj) { String format = (String) jObj.get(JSONKeys.FORMAT); boolean hasBody = jObj.containsKey(JSONKeys.BODY); if (!jObj.containsKey(JSONKeys.DOCID)) return DocType.UNKNOWN; else {//from w w w . ja v a 2 s. com if (format != null && (format.equals(Formats.TEXT) || format.equals(Formats.MVD_TEXT)) && hasBody) return DocType.CORTEX; if (hasBody && format != null && (format.equals(Formats.MVD_STIL) || format.equals(Formats.STIL))) return DocType.CORCODE; if (jObj.containsKey(JSONKeys.OFFSET) && jObj.containsKey(JSONKeys.LEN) && jObj.containsKey(JSONKeys.USER) && jObj.containsKey(JSONKeys.CONTENT)) return DocType.ANNOTATION; else return DocType.UNKNOWN; } }
From source file:me.timothy.ddd.entities.JSONCompatible.java
public static int getInt(JSONObject obj, String key) { return ((Number) obj.get(key)).intValue(); }
From source file:me.timothy.ddd.entities.JSONCompatible.java
public static float getFloat(JSONObject obj, String key) { return ((Number) obj.get(key)).floatValue(); }
From source file:me.timothy.ddd.entities.JSONCompatible.java
public static double getDouble(JSONObject obj, String key) { return ((Number) obj.get(key)).doubleValue(); }
From source file:me.timothy.ddd.entities.JSONCompatible.java
public static String getString(JSONObject obj, String key) { return ((String) obj.get(key)) != null ? ((String) obj.get(key)).replace("\\n", "\n") : null; }
From source file:me.timothy.ddd.entities.JSONCompatible.java
public static JSONArray getArray(JSONObject obj, String key) { return (JSONArray) obj.get(key); }
From source file:me.timothy.ddd.entities.JSONCompatible.java
public static JSONObject getObject(JSONObject obj, String key) { return (JSONObject) obj.get(key); }
From source file:de.hstsoft.sdeep.model.Position.java
public static Position parseVector(JSONObject vec) { Position pos = new Position(); pos.x = Utils.toFloat(vec.get("x").toString()); pos.y = Utils.toFloat(vec.get("y").toString()); pos.z = Utils.toFloat(vec.get("z").toString()); return pos;/*from w w w . j a va 2 s .co m*/ }
From source file:cc.vidr.datum.builtin.FreebaseSearch.java
/** * Return the atom that is the best match for the given query. * // w ww.ja va2 s . co m * @param query the query * @return the atom */ private static Atom search(String query) throws Exception { List<JSONObject> result = FreebaseUtils.getResultList(path + URLEncoder.encode(query, "UTF-8")); JSONObject result0 = result.get(0); String id = (String) result0.get("id"); return FreebaseUtils.atomFromID(id); }