Class JsonNormalizer
java.lang.Object
dev.toonformat.jtoon.normalizer.JsonNormalizer
Normalizes Java objects to Jackson JsonNode representation.
Handles Java-specific types like LocalDateTime, Optional, Stream, etc.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final tools.jackson.databind.ObjectMapperShared ObjectMapper instance configured for JSON normalization. -
Method Summary
-
Field Details
-
MAPPER
public static final tools.jackson.databind.ObjectMapper MAPPERShared ObjectMapper instance configured for JSON normalization.
-
-
Method Details
-
parse
Parses a JSON string into a JsonNode using the shared ObjectMapper.This centralizes JSON parsing concerns to keep the public API thin and maintain separation of responsibilities between parsing, normalization, and encoding.
- Parameters:
json- The JSON string to parse (must be non-blank)- Returns:
- Parsed JsonNode
- Throws:
IllegalArgumentException- if the input is blank or not valid JSON
-
normalize
Normalizes any Java object to a JsonNode.- Parameters:
value- The value to normalize- Returns:
- The normalized JsonNode
-