Package com.networknt.schema.utils
Class JsonNodes
java.lang.Object
com.networknt.schema.utils.JsonNodes
Utility methods for JsonNode.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends com.fasterxml.jackson.databind.JsonNode>
TGets the node found at the path.static <T extends com.fasterxml.jackson.databind.JsonNode>
TGets the node given the property or index.static com.fasterxml.jackson.databind.JsonNodereadTree(com.fasterxml.jackson.databind.ObjectMapper objectMapper, InputStream inputStream, JsonNodeFactoryFactory jsonNodeFactoryFactory) Read aJsonNodefrom anInputStream.static com.fasterxml.jackson.databind.JsonNodereadTree(com.fasterxml.jackson.databind.ObjectMapper objectMapper, String content, JsonNodeFactoryFactory jsonNodeFactoryFactory) Read aJsonNodefromStringcontent.static com.fasterxml.jackson.core.JsonLocationtokenStreamLocationOf(com.fasterxml.jackson.databind.JsonNode jsonNode) Gets the token location of theJsonNodethat implementsTokenStreamLocationAware.
-
Constructor Details
-
JsonNodes
public JsonNodes()
-
-
Method Details
-
get
public static <T extends com.fasterxml.jackson.databind.JsonNode> T get(com.fasterxml.jackson.databind.JsonNode node, NodePath path) Gets the node found at the path.- Type Parameters:
T- the type of the node- Parameters:
node- the nodepath- the path- Returns:
- the node found at the path or null
-
get
public static <T extends com.fasterxml.jackson.databind.JsonNode> T get(com.fasterxml.jackson.databind.JsonNode node, Object propertyOrIndex) Gets the node given the property or index.- Type Parameters:
T- the type of the node- Parameters:
node- the nodepropertyOrIndex- the property or index- Returns:
- the node given the property or index
-
readTree
public static com.fasterxml.jackson.databind.JsonNode readTree(com.fasterxml.jackson.databind.ObjectMapper objectMapper, String content, JsonNodeFactoryFactory jsonNodeFactoryFactory) Read aJsonNodefromStringcontent.- Parameters:
objectMapper- the object mappercontent- the string contentjsonNodeFactoryFactory- the factory- Returns:
- the json node
-
readTree
public static com.fasterxml.jackson.databind.JsonNode readTree(com.fasterxml.jackson.databind.ObjectMapper objectMapper, InputStream inputStream, JsonNodeFactoryFactory jsonNodeFactoryFactory) Read aJsonNodefrom anInputStream.- Parameters:
objectMapper- the object mapperinputStream- the string contentjsonNodeFactoryFactory- the factory- Returns:
- the json node
-
tokenStreamLocationOf
public static com.fasterxml.jackson.core.JsonLocation tokenStreamLocationOf(com.fasterxml.jackson.databind.JsonNode jsonNode) Gets the token location of theJsonNodethat implementsTokenStreamLocationAware.- Parameters:
jsonNode- the node- Returns:
- the JsonLocation
-