@Deprecated public static Object tryParseJson(Object object, boolean nullify) { return tryParseJson(object, nullify, false); }
@Deprecated public static int getElements(Object object) { final Object json = tryParseJson(object, true); if (json instanceof JSONArray) return ((JSONArray) json).length(); if (json instanceof JSONObject) return ((JSONObject) json).length(); return 0; }
@Deprecated public static EwJsonCollection tryConvert(Object object) { final Object converted = tryParseJson(object, false); if (converted instanceof JSONArray) return EwJsonArray.convert((JSONArray) converted); if (converted instanceof JSONObject) return EwJsonObject.convert((JSONObject) converted); return null; }
@Deprecated private static Object getElement(Object object, Object ref) { final Object json = tryParseJson(object, true); if (json == null || ref == null) return null; if (json instanceof JSONArray) return ((JSONArray) json).opt(keyToIndex(ref)); if (json instanceof JSONObject) return ((JSONObject) json).opt(ref.toString()); return null; }
@Deprecated public static boolean hasComplexKey(Object object, String key) throws JSONException { final Object json = tryParseJson(object, true); if (!isComplexKey(key) || !isJson(json)) return false; return (processComplexKey(json, KEY_PATTERN.split(key)).size() > 0); }
@Deprecated private static Object derefBracketedKey(Object object, String key) throws JSONException { final Object jsonObject = tryParseJson(object, true); if (jsonObject == null || key == null) return null; if (key.indexOf(KEY_DELIM) != -1) return derefComplexKey(jsonObject, key); if (!isBracketedKey(key)) return getElement(jsonObject, key); /* * Dereference key or index from array or object -- null if non-existent */ // For key "arr[0][1]": outer is "arr", inner is "0", next is "[1]" final int keyDelim = key.indexOf(ARR_OPEN); final int keyLength = key.indexOf(ARR_CLOSE) + 1; final String outerKey = key.substring(0, keyDelim); final String innerKey = key.substring(keyDelim + 1, keyLength - 1); if (isBracketedKey(innerKey)) throw new JSONException("Invalid inner key: " + key); final String nextKey = (keyLength < key.length()) ? key.substring(keyLength) : ""; if (nextKey.length() > 0 && nextKey.charAt(0) != ARR_OPEN) throw new JSONException("Invalid next key: " + key); final Object nextObject = (outerKey.isEmpty()) ? getElement(jsonObject, innerKey) : derefCompositeKey(getElement(jsonObject, outerKey), innerKey); return (nextKey.isEmpty()) ? nextObject : derefCompositeKey(nextObject, nextKey); }
@Deprecated private static Object derefObjectIndexKey(Object object, String key) throws JSONException object = tryParseJson(object, true);
return tryParseJson(object, false); final Object json = tryParseJson(object, true);
final Object element = EwJson.tryParseJson(ja.get(i),false); if (element instanceof JSONObject)
object = tryParseJson(object, false, reduce);
results.add(tryParseJson(object, false));