toggle menu
Algoutils
0.9.1-SNAPSHOT
jvm
switch theme
search in API
algoutils-tutor
/
org.tudalgo.algoutils.tutor.general.json
/
JsonConverters
Json
Converters
public
class
JsonConverters
(
source
)
A class that contains methods to convert
JsonNodes
to java objects.
Members
Constructors
Json
Converters
Link copied to clipboard
public
void
JsonConverters
(
)
Properties
DEFAULT_CONVERTERS
Link copied to clipboard
public
final
static
Map
<
String
,
Function
<
JsonNode
,
? extends
Object
>
>
DEFAULT_CONVERTERS
The default converters that are used if no custom converters are given.
Functions
convert
Link copied to clipboard
public
T
convert
<
T
>
(
JsonNode
node
,
String
key
,
Class
<
T
>
type
,
ObjectMapper
objectMapper
)
public
static
T
convert
<
T
>
(
JsonNode
node
,
String
key
,
Class
<
T
>
type
,
ObjectMapper
objectMapper
,
Map
<
String
,
Function
<
JsonNode
,
? extends
Object
>
>
converters
)
Converts a
JsonNode
to a
T
by applying the given
mapper
to the json node.
to
Int
Map
Link copied to clipboard
public
static
Map
<
Integer
,
Integer
>
toIntMap
(
JsonNode
jsonNode
)
Converts a
JsonNode
to a
Map
of
Integer
s and
Integer
s by parsing the keys and values of the json node.
to
List
Link copied to clipboard
public
static
List
<
T
>
toList
<
T
>
(
JsonNode
jsonNode
,
Function
<
JsonNode
,
T
>
mapper
)
Converts a
JsonNode
to a
List
of
T
s by applying the given
mapper
to each element of the json node.
to
Map
Link copied to clipboard
public
static
Map
<
K
,
V
>
toMap
<
K
,
V
>
(
JsonNode
jsonNode
,
Function
<
String
,
K
>
keyMapper
,
Function
<
JsonNode
,
V
>
valueMapper
)
Converts a
JsonNode
to a
Map
of
K
s and
V
s by applying the given
keyMapper
to each key and the
valueMapper
to each value of the json node.