Interface JsonNodeFactory

All Known Implementing Classes:
GsonNode.Factory, JacksonNode.Factory, JakartaJsonNode.Factory, JettisonNode.Factory, JsonSmartNode.Factory, OrgJsonNode.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. Main purpose of this method is to avoid additional JSON parsing. If passed object is already JsonNode it should be returned directly.
      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.
      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)