public interface JSONContentModel extends ContentModel
ContentContainer
. Content is accessed using lists of strings
or integers. Strings are used to access named children in the JSON object
while integers are used to access specific values in JSON arrays.ContentContainer
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.Object> |
getChildrenAt(java.util.List<java.lang.Object> path,
com.ibm.json.java.JSONArtifact artifact)
Returns the list of objects at the specified path if the path leads to
a JSON array or
null otherwise. |
java.util.Map<java.lang.Object,java.lang.Object> |
getChildValuesAt(java.util.List<java.lang.Object> path,
com.ibm.json.java.JSONArtifact artifact)
Returns the child values of the specified path if the path leads to
a JSON object or
null otherwise. |
java.lang.String |
getJSONAsString()
Returns the JSON content as a string.
|
java.lang.Object |
getObjectAt(java.util.List<java.lang.Object> path,
com.ibm.json.java.JSONArtifact artifact)
Returns the object at the specified path.
|
getContainerName, reset
java.lang.String getJSONAsString()
java.lang.Object getObjectAt(java.util.List<java.lang.Object> path, com.ibm.json.java.JSONArtifact artifact) throws java.lang.Exception
null
in which case the root of the content is used.
The returned value may be a literal string, integer, real or boolean,
or a JSON artifact (either a JSON object or a JSON array).path
- the path to the required objectartifact
- the starting artifact or null
java.lang.Exception
- if there is an error parsing the JSON
or when accessing specific contentjava.util.Map<java.lang.Object,java.lang.Object> getChildValuesAt(java.util.List<java.lang.Object> path, com.ibm.json.java.JSONArtifact artifact) throws java.lang.Exception
null
otherwise. The keys in the table are strings
while the associated value may be a literal string, integer, real or boolean,
or a JSON artifact (either a JSON object or a JSON array).path
- the path to the required objectartifact
- the starting artifact or null
java.lang.Exception
- if there is an error parsing the JSON
or when accessing specific contentjava.util.List<java.lang.Object> getChildrenAt(java.util.List<java.lang.Object> path, com.ibm.json.java.JSONArtifact artifact) throws java.lang.Exception
null
otherwise. The returned values may be a
literal string, integer, real or boolean, or a JSON artifact (either a JSON object or a JSON array).path
- the path to the required objectartifact
- the starting artifact or null
java.lang.Exception
- if there is an error parsing the JSON
or when accessing specific content(C) Copyright IBM Corp. 1994, 2015. All Rights Reserved.