/** * Reads a JSON array from the given string. * * @param string * the string that contains the JSON array * @return the JSON array that has been read * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON array * @deprecated Use {@link Json#parse(String)}{@link JsonValue#asArray() .asArray()} instead */ @Deprecated public static JsonArray readFrom(String string) { return JsonValue.readFrom(string).asArray(); }
/** * Reads a JSON object from the given string. * * @param string * the string that contains the JSON object * @return the JSON object that has been read * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON object * @deprecated Use {@link Json#parse(String)}{@link JsonValue#asObject() .asObject()} instead */ @Deprecated public static JsonObject readFrom(String string) { return JsonValue.readFrom(string).asObject(); }
/** * Reads a JSON array from the given reader. * <p> * Characters are read in chunks and buffered internally, therefore wrapping an existing reader in * an additional <code>BufferedReader</code> does <strong>not</strong> improve reading * performance. * </p> * * @param reader * the reader to read the JSON array from * @return the JSON array that has been read * @throws IOException * if an I/O error occurs in the reader * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON array * @deprecated Use {@link Json#parse(Reader)}{@link JsonValue#asArray() .asArray()} instead */ @Deprecated public static JsonArray readFrom(Reader reader) throws IOException { return JsonValue.readFrom(reader).asArray(); }
/** * Reads a JSON object from the given reader. * <p> * Characters are read in chunks and buffered internally, therefore wrapping an existing reader in * an additional <code>BufferedReader</code> does <strong>not</strong> improve reading * performance. * </p> * * @param reader * the reader to read the JSON object from * @return the JSON object that has been read * @throws IOException * if an I/O error occurs in the reader * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON object * @deprecated Use {@link Json#parse(Reader)}{@link JsonValue#asObject() .asObject()} instead */ @Deprecated public static JsonObject readFrom(Reader reader) throws IOException { return JsonValue.readFrom(reader).asObject(); }
public static JsonValue parseJsonValue(InputStream inputStream) throws IOException { JsonValue jsonValue; try (InputStreamReader reader = new InputStreamReader(inputStream, "UTF-8")) { jsonValue = JsonValue.readFrom(reader); } return jsonValue; }
protected JsonValue parseJsonObject(Object obj) { String json = ((BoxJsonObject) obj).toJson(); JsonValue value = JsonValue.readFrom(json); return value; }
/** * Sets the body of this request to a given JSON string. * @param body the JSON string to use as the body. */ @Override public void setBody(String body) { super.setBody(body); this.jsonValue = JsonValue.readFrom(body); }
/** * Reads a JSON object from the given string. * * @param string * the string that contains the JSON object * @return the JSON object that has been read * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON object */ public static JsonObject readFrom( String string ) { return JsonValue.readFrom( string ).asObject(); }
/** * Reads a JSON array from the given string. * * @param string * the string that contains the JSON array * @return the JSON array that has been read * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON array */ public static JsonArray readFrom( String string ) { return JsonValue.readFrom( string ).asArray(); }
/** * Reads a JSON array from the given string. * * @param string * the string that contains the JSON array * @return the JSON array that has been read * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON array * @deprecated Use {@link Json#parse(String)}{@link JsonValue#asArray() .asArray()} instead */ @Deprecated public static JsonArray readFrom(String string) { return JsonValue.readFrom(string).asArray(); }
/** * Reads a JSON object from the given string. * * @param string * the string that contains the JSON object * @return the JSON object that has been read * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON object * @deprecated Use {@link Json#parse(String)}{@link JsonValue#asObject() .asObject()} instead */ @Deprecated public static JsonObject readFrom(String string) { return JsonValue.readFrom(string).asObject(); }
/** * Reads a JSON object from the given string. * * @param string * the string that contains the JSON object * @return the JSON object that has been read * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON object * @deprecated Use {@link Json#parse(String)}{@link JsonValue#asObject() .asObject()} instead */ @Deprecated public static JsonObject readFrom(String string) { return JsonValue.readFrom(string).asObject(); }
/** * Reads a JSON array from the given string. * * @param string * the string that contains the JSON array * @return the JSON array that has been read * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON array * @deprecated Use {@link Json#parse(String)}{@link JsonValue#asArray() .asArray()} instead */ @Deprecated public static JsonArray readFrom(String string) { return JsonValue.readFrom(string).asArray(); }
/** * Reads a JSON array from the given reader. * <p> * Characters are read in chunks and buffered internally, therefore wrapping an existing reader in * an additional <code>BufferedReader</code> does <strong>not</strong> improve reading * performance. * </p> * * @param reader * the reader to read the JSON array from * @return the JSON array that has been read * @throws IOException * if an I/O error occurs in the reader * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON array * @deprecated Use {@link Json#parse(Reader)}{@link JsonValue#asArray() .asArray()} instead */ @Deprecated public static JsonArray readFrom(Reader reader) throws IOException { return JsonValue.readFrom(reader).asArray(); }
/** * Reads a JSON array from the given reader. * <p> * Characters are read in chunks and buffered internally, therefore wrapping an existing reader in * an additional <code>BufferedReader</code> does <strong>not</strong> improve reading * performance. * </p> * * @param reader * the reader to read the JSON array from * @return the JSON array that has been read * @throws IOException * if an I/O error occurs in the reader * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON array */ public static JsonArray readFrom( Reader reader ) throws IOException { return JsonValue.readFrom( reader ).asArray(); }
/** * Reads a JSON object from the given reader. * <p> * Characters are read in chunks and buffered internally, therefore wrapping an existing reader in * an additional <code>BufferedReader</code> does <strong>not</strong> improve reading * performance. * </p> * * @param reader * the reader to read the JSON object from * @return the JSON object that has been read * @throws IOException * if an I/O error occurs in the reader * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON object * @deprecated Use {@link Json#parse(Reader)}{@link JsonValue#asObject() .asObject()} instead */ @Deprecated public static JsonObject readFrom(Reader reader) throws IOException { return JsonValue.readFrom(reader).asObject(); }
/** * Reads a JSON object from the given reader. * <p> * Characters are read in chunks and buffered internally, therefore wrapping an existing reader in * an additional <code>BufferedReader</code> does <strong>not</strong> improve reading * performance. * </p> * * @param reader * the reader to read the JSON object from * @return the JSON object that has been read * @throws IOException * if an I/O error occurs in the reader * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON object */ public static JsonObject readFrom( Reader reader ) throws IOException { return JsonValue.readFrom( reader ).asObject(); }
/** * Reads a JSON array from the given reader. * <p> * Characters are read in chunks and buffered internally, therefore wrapping an existing reader in * an additional <code>BufferedReader</code> does <strong>not</strong> improve reading * performance. * </p> * * @param reader * the reader to read the JSON array from * @return the JSON array that has been read * @throws IOException * if an I/O error occurs in the reader * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON array * @deprecated Use {@link Json#parse(Reader)}{@link JsonValue#asArray() .asArray()} instead */ @Deprecated public static JsonArray readFrom(Reader reader) throws IOException { return JsonValue.readFrom(reader).asArray(); }
/** * Reads a JSON object from the given reader. * <p> * Characters are read in chunks and buffered internally, therefore wrapping an existing reader in * an additional <code>BufferedReader</code> does <strong>not</strong> improve reading * performance. * </p> * * @param reader * the reader to read the JSON object from * @return the JSON object that has been read * @throws IOException * if an I/O error occurs in the reader * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON object * @deprecated Use {@link Json#parse(Reader)}{@link JsonValue#asObject() .asObject()} instead */ @Deprecated public static JsonObject readFrom(Reader reader) throws IOException { return JsonValue.readFrom(reader).asObject(); }
/** * Gets the value associated with the key in the property map * * @param name name of the property * @return Value of the key */ public JsonValue getPropertyValue(String name) { // Return a copy of json value to ensure user can't change the underlying object directly JsonValue jsonValue = mCacheMap.getAsJsonValue(name); return jsonValue == null ? null : JsonValue.readFrom(jsonValue.toString()); }