public class JsonLoader extends Object
ResourceLoader
to load content at URIs and parse it into YAML or JSON.
If the data fetched from a URI starts with a { or [
character, it will be assumed to be JSON and JsonParser will be used.
Otherwise YAMLParser will be used. JSON data can contain certain unicode
characters that YAML cannot, so it is best to use JsonParser when we can.Constructor and Description |
---|
JsonLoader(ResourceLoader resourceLoader) |
Modifier and Type | Method and Description |
---|---|
String |
asString(com.fasterxml.jackson.databind.JsonNode jsonNode)
Convenience method to reuse our ObjectMapper to serialize a JsonNode
to a JSON String.
|
<T> T |
convertValue(com.fasterxml.jackson.databind.JsonNode jsonNode,
Class<T> t)
Convenience method to reuse our ObjectMapper to convert a JsonNode to a Java Class.
|
ResourceLoader |
getResourceLoader()
Returns the underlying
ResourceLoader . |
com.fasterxml.jackson.databind.JsonNode |
load(URI uri)
Given a schemaURI, this will request the JSON or YAML content at that URI and
parse it into a JsonNode.
|
com.fasterxml.jackson.databind.JsonNode |
parse(String data)
Parses the JSON or YAML string into a JsonNode.
|
String |
toString() |
public JsonLoader(ResourceLoader resourceLoader)
public com.fasterxml.jackson.databind.JsonNode load(URI uri) throws JsonLoadingException
JsonLoadingException
public com.fasterxml.jackson.databind.JsonNode parse(String data) throws JsonLoadingException
data
- JSON or YAML string to parse into a JsonNode.JsonLoadingException
public String asString(com.fasterxml.jackson.databind.JsonNode jsonNode) throws com.fasterxml.jackson.core.JsonProcessingException
com.fasterxml.jackson.core.JsonProcessingException
public <T> T convertValue(com.fasterxml.jackson.databind.JsonNode jsonNode, Class<T> t)
ObjectMapper.convertValue(Object, Class)
public ResourceLoader getResourceLoader()
ResourceLoader
.Copyright © 2025. All rights reserved.