Package io.micronaut.jackson.core.tree
Class JsonNodeTreeCodec
java.lang.Object
io.micronaut.jackson.core.tree.JsonNodeTreeCodec
Codec for transforming
JsonNode
from and to json streams.- Since:
- 3.1
- Author:
- Jonas Konrad
-
Method Summary
Modifier and TypeMethodDescriptionCreate aJsonGenerator
that will return aJsonNode
when completed.static JsonNodeTreeCodec
readTree
(com.fasterxml.jackson.core.JsonParser p) Read a json node from a stream.com.fasterxml.jackson.core.JsonParser
treeAsTokens
(JsonNode node) Create a new parser that traverses over the given json node.withConfig
(JsonStreamConfig config) void
Write a json node to a json stream.
-
Method Details
-
getInstance
- Returns:
- The default instance, using
JsonStreamConfig.DEFAULT
.
-
withConfig
- Parameters:
config
- The stream config to use.- Returns:
- A new codec that will use the given stream config.
-
readTree
Read a json node from a stream.- Parameters:
p
- The stream to parse.- Returns:
- The parsed json node.
- Throws:
IOException
- IOException
-
writeTree
public void writeTree(com.fasterxml.jackson.core.JsonGenerator generator, JsonNode tree) throws IOException Write a json node to a json stream.- Parameters:
generator
- The output json stream.tree
- The node to write.- Throws:
IOException
- IOException
-
treeAsTokens
Create a new parser that traverses over the given json node.- Parameters:
node
- The json node to traverse over.- Returns:
- The parser that will visit the json node.
-
createTreeGenerator
Create aJsonGenerator
that will return aJsonNode
when completed.- Returns:
- The generator.
-