Class JsonNodes

java.lang.Object
com.networknt.schema.utils.JsonNodes

public class JsonNodes extends Object
Utility methods for JsonNode.
  • Constructor Details

    • JsonNodes

      public JsonNodes()
  • Method Details

    • get

      public static <T extends tools.jackson.databind.JsonNode> T get(tools.jackson.databind.JsonNode node, NodePath path)
      Gets the node found at the path.
      Type Parameters:
      T - the type of the node
      Parameters:
      node - the node
      path - the path
      Returns:
      the node found at the path or null
    • get

      public static <T extends tools.jackson.databind.JsonNode> T get(tools.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 node
      propertyOrIndex - the property or index
      Returns:
      the node given the property or index
    • readTree

      public static tools.jackson.databind.JsonNode readTree(tools.jackson.databind.ObjectMapper objectMapper, String content, JsonNodeFactoryFactory jsonNodeFactoryFactory)
      Read a JsonNode from String content.
      Parameters:
      objectMapper - the object mapper
      content - the string content
      jsonNodeFactoryFactory - the factory
      Returns:
      the json node
    • readTree

      public static tools.jackson.databind.JsonNode readTree(tools.jackson.databind.ObjectMapper objectMapper, InputStream inputStream, JsonNodeFactoryFactory jsonNodeFactoryFactory)
      Read a JsonNode from an InputStream.
      Parameters:
      objectMapper - the object mapper
      inputStream - the string content
      jsonNodeFactoryFactory - the factory
      Returns:
      the json node
    • tokenStreamLocationOf

      public static tools.jackson.core.TokenStreamLocation tokenStreamLocationOf(tools.jackson.databind.JsonNode jsonNode)
      Gets the token location of the JsonNode that implements TokenStreamLocationAware.
      Parameters:
      jsonNode - the node
      Returns:
      the TokenStreamLocation