Interface JsonNodeFactory

All Known Implementing Classes:
GsonNode.Factory, JacksonNode.Factory, JakartaJsonNode.Factory, JettisonNode.Factory, JsonSmartNode.Factory, KotlinxJsonNode.Factory, OrgJsonNode.Factory, SnakeYamlNode.Factory

public interface JsonNodeFactory
JsonNodeFactory interface is the main abstraction for provider-agnostic JSON factory.
  • Method Details

    • wrap

      JsonNode wrap(Object node)
      Wraps provider specific JSON node into JsonNode. The returned node is considered a root node and all further JSON pointers will be calculated from this node. Main purpose of this method is to avoid additional JSON parsing. It can also be used to convert any instance of JsonNode to a root node.
      Parameters:
      node - provider specific representation of JSON node
      Returns:
      wrapped node
      Throws:
      RuntimeException - when provided node is of invalid type
    • create

      JsonNode create(String rawJson)
      Creates JsonNode from raw JSON string. The returned node is considered a root node and all further JSON pointers will be calculated from this node.
      Parameters:
      rawJson - JSON in string form
      Returns:
      created node
      Throws:
      RuntimeException - when creation fails for any reasons (e.g. provided string is not a valid JSON)