public class JsonReadingUtils extends Object
Note: This class is for internal use only and subject to backward incompatible change at any time.
Modifier and Type | Method and Description |
---|---|
static JsonNode |
readFully(JsonFactory jsonFactory,
String json)
Fully read the supplied JSON string into the equivalent
JsonNode . |
static ObjectNode |
readFullyAsObjectNode(JsonFactory jsonFactory,
String json)
Fully read a JSON string into an
ObjectNode , throwing a JsonParseException if the supplied string
is not a valid JSON object representation. |
public static JsonNode readFully(JsonFactory jsonFactory, String json) throws IOException
JsonNode
.
Throws a JsonParseException
if the string is not fully read after a first valid JsonNode is found.
This may happen for input like 10 foobar that would otherwise return a NumericNode with value
10
leaving foobar unread.jsonFactory
- the JsonFactory
from which to obtain a JsonParser
to read the JSON string.json
- the JSON string to readJsonNode
corresponding to the input string or null
if the string is null or empty.IOException
- if there is either an underlying I/O problem or decoding issuepublic static ObjectNode readFullyAsObjectNode(JsonFactory jsonFactory, String json) throws IOException
ObjectNode
, throwing a JsonParseException
if the supplied string
is not a valid JSON object representation.jsonFactory
- the JsonFactory
from which to obtain a JsonParser
to read the JSON string.json
- the JSON string to readJsonNode
corresponding to the input string or null
if the string is null or empty.IOException
- if there is either an underlying I/O problem or decoding issuereadFully(JsonFactory, String)
Copyright © 2013–2021. All rights reserved.