/**
  * 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();
 }
Beispiel #2
0
 /**
  * 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.
  *
  * @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.
  *
  * @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();
 }
Beispiel #4
0
 /**
  * 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();
 }