public class JsonUtil
Utilities for examining and processing content that is or can be JSON.
Modifiers | Name | Description |
---|---|---|
static boolean |
REMOVE_D_ELEMENT |
Type Params | Return Type | Name and description |
---|---|---|
|
public static void |
ensureJsonValid(java.lang.String value) |
|
public static java.lang.String |
format(java.lang.Object json) |
|
public static Configuration |
getDefaultConfiguration() |
|
public java.lang.String |
getFormattedStringValue(JsonNode value) |
|
public static java.lang.String |
getFormattedStringValue(java.lang.String jsonContent) |
|
public static JsonNode |
getJson(java.lang.String value) |
|
public static JsonNode |
getJsonFromXml(java.lang.String xml) |
|
public static java.lang.String |
getJsonNodeText(JsonNode jsonNode) |
|
public static ObjectMapper |
getMapper() |
|
public static java.lang.String |
getStringRepresentationForValueNode(ValueNode value) |
|
public static JsonNode |
getValidJson(java.lang.String value) |
|
public static JsonNode |
getValidJson(java.lang.String value, ObjectMapper mapper) |
|
public static JsonNode |
getValidJsonFromXml(java.lang.String xml) |
|
public static java.lang.Object |
getValueNodeValue(ValueNode node) |
|
public static XmlMapper |
getXmlMapper() |
|
public static boolean |
isObjectOrArray(java.lang.String value) |
|
public static boolean |
isSimpleValue(java.lang.String value) |
|
public static boolean |
isValidJson(java.lang.String value) |
|
public static boolean |
isValidJsonEx(java.lang.String jsonText, boolean hideLogMessages) one more way to check json content. |
|
public static boolean |
isValidJsonEx(java.lang.String jsonText) |
|
public static JsonNode |
parseTrimmedText(java.lang.String text) |
|
public static java.lang.String |
removeVulnerabilityTokens(java.lang.String inputJsonString) |
|
public static boolean |
seemsToBeJson(java.lang.String content, boolean failOnTrailingTokens) Since ObjectMapper is able to read a JSON text as a serialized value also, the method with the feature option provides more strict validation for an invalid JSON text JsonUtil.seemsToBeJson |
|
public static boolean |
seemsToBeJson(java.lang.String content) |
|
public static boolean |
seemsToBeJsonContentType(java.lang.String contentType) This method and its name are somewhat awkward, but both stem from the fact that there are so many commonly used content types for JSON. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
one more way to check json content.
Since ObjectMapper is able to read a JSON text as a serialized value also, the method with the feature option provides more strict validation for an invalid JSON text JsonUtil.seemsToBeJson
content
- content to readfailOnTrailingTokens
- parameter means the parser should fail if there are any trailing tokens,
provides more strict json validationThis method and its name are somewhat awkward, but both stem from the fact that there are so many commonly used content types for JSON.
contentType
- the MIME type to examinetrue
if content type is non-null and contains either "json" or "javascript"