Package org.ametys.core.util
Class JSONUtils
java.lang.Object
org.ametys.core.util.JSONUtils
- All Implemented Interfaces:
Initializable
,Component
,Serviceable
,ThreadSafe
JSON helper
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionObject[]
convertJsonToArray
(String jsonString) Parse a JSON string to an Object array.convertJsonToList
(String jsonString) Parse a JSON string to aList
object.convertJsonToMap
(String jsonString) Parse a JSON string to aMap
objectString[]
convertJsonToStringArray
(String jsonString) Parse a JSON string to a String array.void
convertObjectToJson
(OutputStream out, Object parameters) Convert an object to JSON string using specified output stream.convertObjectToJson
(Object parameters) Convert an object to a JSON stringvoid
void
service
(ServiceManager manager)
-
Field Details
-
ROLE
The avalon role
-
-
Constructor Details
-
JSONUtils
public JSONUtils()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
convertJsonToMap
Parse a JSON string to aMap
object- Parameters:
jsonString
- the string to parse- Returns:
- object the infos as a Map.
-
convertJsonToList
Parse a JSON string to aList
object.- Parameters:
jsonString
- the string to parse.- Returns:
- the infos as a List.
-
convertJsonToArray
Parse a JSON string to an Object array.- Parameters:
jsonString
- the JSON string to parse.- Returns:
- the converted Object array.
-
convertJsonToStringArray
Parse a JSON string to a String array.- Parameters:
jsonString
- the JSON string to parse.- Returns:
- the converted String array.
-
convertObjectToJson
Convert an object to JSON string using specified output stream.- Parameters:
out
- The output streamparameters
- The object to convert
-
convertObjectToJson
Convert an object to a JSON string- Parameters:
parameters
- The object to convert (List, Map ..)- Returns:
- The JSON string
-