Interface JsonProvider
- All Known Implementing Classes:
AbstractJsonProvider, GsonJsonProvider, JacksonJsonNodeJsonProvider, JacksonJsonProvider, JsonSmartJsonProvider
public interface JsonProvider
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionCreates a provider specific json arrayCreates a provider specific json objectgetArrayIndex(Object obj, int idx) Extracts a value from an array anw unwraps provider specific data typegetArrayIndex(Object obj, int idx, boolean unwrap) Deprecated.getMapValue(Object obj, String key) Extracts a value from an mapgetPropertyKeys(Object obj) Returns the keys from the given objectbooleanchecks if object is an arraybooleanchecks if object is a map (i.e.intGet the length of an json array, json object or a json stringparse(InputStream jsonStream, String charset) Parse the given json stringParse the given json stringvoidremoveProperty(Object obj, Object key) Removes a value in an object or arrayvoidsetArrayIndex(Object array, int idx, Object newValue) Sets a value in an array.voidsetProperty(Object obj, Object key, Object value) Sets a value in an objectIterable<?> toIterable(Object obj) Converts given array to anIterableConvert given json object to a json stringExtracts a value from a wrapper object.
-
Field Details
-
UNDEFINED
-
-
Method Details
-
parse
Parse the given json string- Parameters:
json- json string to parse- Returns:
- Object representation of json
- Throws:
InvalidJsonException
-
parse
Parse the given json string- Parameters:
jsonStream- input stream to parsecharset- charset to use- Returns:
- Object representation of json
- Throws:
InvalidJsonException
-
toJson
-
createArray
-
createMap
-
isArray
checks if object is an array- Parameters:
obj- object to check- Returns:
- true if obj is an array
-
length
Get the length of an json array, json object or a json string- Parameters:
obj- an array or object or a string- Returns:
- the number of entries in the array or object
-
toIterable
-
getPropertyKeys
Returns the keys from the given object- Parameters:
obj- an object- Returns:
- the keys for an object
-
getArrayIndex
-
getArrayIndex
Deprecated.Extracts a value from an array- Parameters:
obj- an arrayidx- indexunwrap- should provider specific data type be unwrapped- Returns:
- the entry at the given index
-
setArrayIndex
-
getMapValue
-
setProperty
-
removeProperty
-
isMap
checks if object is a map (i.e. no array)- Parameters:
obj- object to check- Returns:
- true if the object is a map
-
unwrap
-