Java Code Examples for com.eclipsesource.json.JsonValue#readFrom()

The following examples show how to use com.eclipsesource.json.JsonValue#readFrom() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Utils.java    From Skype4J with Apache License 2.0 5 votes vote down vote up
public static JsonValue parseJsonValue(InputStream inputStream) throws IOException {
    JsonValue jsonValue;
    try (InputStreamReader reader = new InputStreamReader(inputStream, "UTF-8")) {
        jsonValue = JsonValue.readFrom(reader);
    }
    return jsonValue;
}
 
Example 2
Source File: BoxRequest.java    From box-android-sdk with Apache License 2.0 4 votes vote down vote up
protected JsonValue parseJsonObject(Object obj) {
    String json = ((BoxJsonObject) obj).toJson();
    JsonValue value = JsonValue.readFrom(json);
    return value;
}
 
Example 3
Source File: BoxJSONRequest.java    From box-java-sdk with Apache License 2.0 4 votes vote down vote up
/**
 * 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);
}
 
Example 4
Source File: BoxJsonObject.java    From box-android-sdk with Apache License 2.0 2 votes vote down vote up
/**
* 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());
}