Interface JsonMapper

All Known Implementing Classes:
JacksonJsonMapper

public interface JsonMapper
Interface for JSON serialization and deserialization. Provides methods to convert objects to JSON strings and parse JSON back to objects.
  • Method Details

    • stringify

      String stringify(Object obj)
      Converts an object to a JSON string.
      Parameters:
      obj - the object to serialize
      Returns:
      JSON string representation
      Throws:
      JsonException - if serialization fails
    • parse

      <T> T parse(String json, Class<T> type)
      Parses a JSON string to an object of the specified type.
      Type Parameters:
      T - the target type
      Parameters:
      json - the JSON string to parse
      type - the target class
      Returns:
      the parsed object
      Throws:
      JsonException - if parsing fails
    • toMap

      Map<String,Object> toMap(String json)
      Parses a JSON string to a Map.
      Parameters:
      json - the JSON string to parse
      Returns:
      the parsed map
      Throws:
      JsonException - if parsing fails
    • toList

      List<Object> toList(String json)
      Parses a JSON string to a List.
      Parameters:
      json - the JSON string to parse
      Returns:
      the parsed list
      Throws:
      JsonException - if parsing fails