public class JsonUtil extends Object
Constructor and Description |
---|
JsonUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
ensureJsonValid(String value) |
static String |
format(Object json) |
static com.jayway.jsonpath.Configuration |
getDefaultConfiguration() |
String |
getFormattedStringValue(com.fasterxml.jackson.databind.JsonNode value) |
static com.fasterxml.jackson.databind.JsonNode |
getJson(String value) |
static com.fasterxml.jackson.databind.JsonNode |
getJsonFromXml(String xml) |
static String |
getJsonNodeText(com.fasterxml.jackson.databind.JsonNode jsonNode) |
static com.fasterxml.jackson.databind.ObjectMapper |
getMapper() |
static String |
getStringRepresentationForValueNode(com.fasterxml.jackson.databind.node.ValueNode value) |
static com.fasterxml.jackson.databind.JsonNode |
getValidJson(String value) |
static com.fasterxml.jackson.databind.JsonNode |
getValidJson(String value,
com.fasterxml.jackson.databind.ObjectMapper mapper) |
static com.fasterxml.jackson.databind.JsonNode |
getValidJsonFromXml(String xml) |
static Object |
getValueNodeValue(com.fasterxml.jackson.databind.node.ValueNode node) |
static com.fasterxml.jackson.dataformat.xml.XmlMapper |
getXmlMapper() |
static boolean |
isObjectOrArray(String value) |
static boolean |
isSimpleValue(String value) |
static boolean |
isValidJson(String value) |
static com.fasterxml.jackson.databind.JsonNode |
parseTrimmedText(String text) |
static String |
removeVulnerabilityTokens(String inputJsonString) |
static boolean |
seemsToBeJson(String content) |
static boolean |
seemsToBeJsonContentType(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.
|
public static com.fasterxml.jackson.databind.ObjectMapper getMapper()
public static com.jayway.jsonpath.Configuration getDefaultConfiguration()
public static com.fasterxml.jackson.dataformat.xml.XmlMapper getXmlMapper()
public static Object getValueNodeValue(com.fasterxml.jackson.databind.node.ValueNode node)
public static boolean isValidJson(String value)
public static boolean isObjectOrArray(String value)
public static boolean isSimpleValue(String value)
public static com.fasterxml.jackson.databind.JsonNode getJson(String value) throws IOException
IOException
public static com.fasterxml.jackson.databind.JsonNode getValidJson(String value)
public static com.fasterxml.jackson.databind.JsonNode getJsonFromXml(String xml) throws IOException
IOException
public static com.fasterxml.jackson.databind.JsonNode getValidJsonFromXml(String xml)
public static String getStringRepresentationForValueNode(com.fasterxml.jackson.databind.node.ValueNode value)
public static void ensureJsonValid(String value) throws IOException
IOException
@Nullable public static com.fasterxml.jackson.databind.JsonNode getValidJson(String value, com.fasterxml.jackson.databind.ObjectMapper mapper)
public static String getJsonNodeText(com.fasterxml.jackson.databind.JsonNode jsonNode)
public static boolean seemsToBeJsonContentType(String contentType)
contentType
- the MIME type to examinetrue
if content type is non-null and contains either "json" or "javascript"public static boolean seemsToBeJson(String content)
public static com.fasterxml.jackson.databind.JsonNode parseTrimmedText(String text) throws IOException
IOException
public String getFormattedStringValue(com.fasterxml.jackson.databind.JsonNode value)
Copyright © 2019. All rights reserved.