public class JsonObject
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static JsonObject |
createFrom(java.io.InputStream in)
Parses JSON content from the input stream and creates new json object
|
static JsonObject |
createFrom(java.lang.String json)
Parses JSON content and creates new json object
|
boolean |
exists(java.lang.String path)
Checks whether the specified path exists in this JSON object.
|
boolean |
getBoolean(java.lang.String jsonPath)
Looks up a
boolean value in the parsed JSON |
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
getCollection(java.lang.String jsonPath)
Looks up entries in the parsed JSONArray
|
java.util.List<java.lang.Object> |
getCollectionOfObjects(java.lang.String path)
Retrieves a collection of data at the location in this object specified by the path.
|
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
getFilteredCollection(java.lang.String jsonPath,
Predicate filter)
Looks up matching entries in the parsed JSONArray
|
java.lang.Object |
getObject(java.lang.String jsonPath)
Looks up a value in the parsed JSON.
|
java.lang.String |
getString(java.lang.String jsonPath)
Looks up a value in the parsed JSON
|
java.lang.String |
toString() |
public static JsonObject createFrom(java.io.InputStream in)
in - an input stream containing JSONpublic static JsonObject createFrom(java.lang.String json)
json - a string in JSON formatpublic java.lang.String getString(java.lang.String jsonPath)
jsonPath - a JSON path, e.g. product.code, pointing to the element whose value needs to be retrieved.jsonPath location.public java.lang.Object getObject(java.lang.String jsonPath)
jsonPath - a JSON path, e.g. product.code, pointing to the element whose value needs to be retrieved.jsonPath location.public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getFilteredCollection(java.lang.String jsonPath,
Predicate filter)
jsonPath - a JSON path, e.g. product.code, pointing to the element whose value needs to be retrieved.filter - Predicate used for filtering matching entry resultsjsonPath location and the predicate.public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getCollection(java.lang.String jsonPath)
jsonPath - a JSON path, e.g. product.code, pointing to the element whose value needs to be retrieved.jsonPath location.java.lang.ClassCastException - when the path points to a non-collection valuePathNotFoundException - when the path does not existpublic java.util.List<java.lang.Object> getCollectionOfObjects(java.lang.String path)
path - path expression to select a collection of objects.null means the path is invalid or does not exist or
the path is pointing to a non-collection element in this json object.public boolean getBoolean(java.lang.String jsonPath)
boolean value in the parsed JSONjsonPath - a JSON path, e.g. catalog.active, pointing to the element whose value needs to be retrieved.jsonPath location.for the rules about how the boolean value is derivedpublic boolean exists(java.lang.String path)
path - a path to check.true, if the path exists in this JSON object and contains non-null value or non-empty value in case when the
path resolves to an array; false, otherwise.public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2018 SAP SE. All Rights Reserved.