Package 

Interface StreamJsonSerialization


  • 
    public interface StreamJsonSerialization
    
                        

    General contract for JSON serialization and deserialization.

    This interface abstracts away the actual JSON parsing engine (e.g. Moshi, Gson, kotlinx.serialization), allowing the SDK to plug in a specific implementation without exposing the underlying library.

    Implementations are expected to provide robust error handling and return results wrapped in Result.

    • Method Summary

      Modifier and Type Method Description
      abstract Result<String> toJson(Object any) Converts an object into its JSON string representation.
      abstract <T extends Any> Result<T> fromJson(String raw, Class<T> clazz) Converts a JSON string into an object of the specified class.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • toJson

         abstract Result<String> toJson(Object any)

        Converts an object into its JSON string representation.

        Parameters:
        any - The object to serialize.
      • fromJson

         abstract <T extends Any> Result<T> fromJson(String raw, Class<T> clazz)

        Converts a JSON string into an object of the specified class.

        Parameters:
        raw - The JSON string to deserialize.
        clazz - The Class of type T that the JSON should be converted into.