Class GsonHelper

java.lang.Object
de.qytera.qtaf.core.gson.GsonHelper

public class GsonHelper extends Object
Helper class for creating GSON objects.
  • Method Details

    • fromJson

      public static <T> T fromJson(String json, Class<T> tClass)
      From JSON to entity.
      Type Parameters:
      T - Entity Type
      Parameters:
      json - JSON string
      tClass - Entity class
      Returns:
      Entity object
    • saveJsonFile

      public static <T> void saveJsonFile(T entity, String filePath)
      Save an entity to a JSON file.
      Type Parameters:
      T - the entity type
      Parameters:
      entity - the entity
      filePath - the path to save the JSON file to