Class JsonNormalizer

java.lang.Object
dev.toonformat.jtoon.normalizer.JsonNormalizer

public final class JsonNormalizer extends Object
Normalizes Java objects to Jackson JsonNode representation. Handles Java-specific types like LocalDateTime, Optional, Stream, etc.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final tools.jackson.databind.ObjectMapper
    Shared ObjectMapper instance configured for JSON normalization.
  • Method Summary

    Modifier and Type
    Method
    Description
    static tools.jackson.databind.JsonNode
    Normalizes any Java object to a JsonNode.
    static tools.jackson.databind.JsonNode
    parse(String json)
    Parses a JSON string into a JsonNode using the shared ObjectMapper.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MAPPER

      public static final tools.jackson.databind.ObjectMapper MAPPER
      Shared ObjectMapper instance configured for JSON normalization.
  • Method Details

    • parse

      public static tools.jackson.databind.JsonNode parse(String json)
      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

      public static tools.jackson.databind.JsonNode normalize(Object value)
      Normalizes any Java object to a JsonNode.
      Parameters:
      value - The value to normalize
      Returns:
      The normalized JsonNode