JsonConverters

public class JsonConverters(source)

A class that contains methods to convert JsonNodes to java objects.

Constructors

Link copied to clipboard
public void JsonConverters()

Properties

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

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.
Link copied to clipboard
public static Map<Integer, Integer> toIntMap(JsonNode jsonNode)
Converts a JsonNode to a Map of Integers and Integers by parsing the keys and values of the json node.
Link copied to clipboard
public static List<T> toList<T>(JsonNode jsonNode, Function<JsonNode, T> mapper)
Converts a JsonNode to a List of Ts by applying the given mapper to each element of the json node.
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 Ks and Vs by applying the given keyMapper to each key and the valueMapper to each value of the json node.