Package org.kordamp.json.util
Class WebUtils
java.lang.Object
org.kordamp.json.util.WebUtils
Provides useful methods for working with JSON and web.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final WebHijackPreventionStrategy
private static WebHijackPreventionStrategy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic WebHijackPreventionStrategy
Returns the configured WebHijackPreventionStrategy.private static String
static String
Transforms the input Json string using the configured WebHijackPreventionStrategy.static String
Transforms the input Json string using the configured WebHijackPreventionStrategy.private static String
static void
Sets a WebHijackPreventionStrategy.
Will use default value (WebHijackPreventionStrategy.INFINITE_LOOP) if null.private static String
static String
Returns a string represenation of a JSON value.
When an object property name does not contain a space (' ') or a colon (':'), the quotes are omitted.private static String
private static String
private static String
toString
(JSONObject jsonObject)
-
Field Details
-
DEFAULT_WEB_HIJACK_PREVENTION_STRATEGY
-
webHijackPreventionStrategy
-
-
Constructor Details
-
WebUtils
private WebUtils()
-
-
Method Details
-
getWebHijackPreventionStrategy
Returns the configured WebHijackPreventionStrategy. -
setWebHijackPreventionStrategy
Sets a WebHijackPreventionStrategy.
Will use default value (WebHijackPreventionStrategy.INFINITE_LOOP) if null. -
protect
Transforms the input Json string using the configured WebHijackPreventionStrategy.- Parameters:
json
- the input string- Returns:
- String a transformed json string
-
protect
Transforms the input Json string using the configured WebHijackPreventionStrategy.- Parameters:
json
- the input stringshrink
- if redundant key quotes may be eliminated.- Returns:
- String a transformed json string
-
toString
Returns a string represenation of a JSON value.
When an object property name does not contain a space (' ') or a colon (':'), the quotes are omitted. This is done to reduce the amount of bytes sent to a web browser.
USE WITH CAUTION. -
join
-
quote
-
toString
-
toString
-
toString
-
toString
-