Class JsUtils
java.lang.Object
io.github.jeemv.springboot.vuejs.utilities.JsUtils
JsUtils This class is part of springBoot-VueJS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic <T> TjsonStringToObject(String jsonString, Class<T> clazz) static StringloadJsFile(String filename) static StringReturns a JSON string from an object, using defined serializersstatic StringwrapScript(String script)
-
Constructor Details
-
JsUtils
public JsUtils()
-
-
Method Details
-
objectToJSON
public static String objectToJSON(Object o) throws com.fasterxml.jackson.core.JsonProcessingException Returns a JSON string from an object, using defined serializers- Parameters:
o- the object to parse- Returns:
- the JSON string
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
jsonStringToObject
public static <T> T jsonStringToObject(String jsonString, Class<T> clazz) throws com.fasterxml.jackson.core.JsonParseException, com.fasterxml.jackson.databind.JsonMappingException, IOException - Throws:
com.fasterxml.jackson.core.JsonParseExceptioncom.fasterxml.jackson.databind.JsonMappingExceptionIOException
-
cleanJS
-
wrapScript
-
loadJsFile
- Throws:
IOException
-