Class Json

java.lang.Object
net.minheur.potoflux.utils.Json

public class Json extends Object
Class to get a Gson.
This allows to have less as possible in the project.
  • Field Details

    • GSON

      public static final com.google.gson.Gson GSON
      Use this to do your simple JSON commands.
  • Method Details

    • loadStringArray

      public static List<String> loadStringArray(String url)
    • listFromObject

      public static List<String> listFromObject(com.google.gson.JsonObject object, String listName)
      Gets a List of String from a JsonObject and it's member name
      Parameters:
      object - the JsonObject to get the list from
      listName - the member name of the list in the JSON
      Returns:
      the list of string contained in the object
    • getOnlineJsonObject

      public static com.google.gson.JsonObject getOnlineJsonObject(String url)
      Gets a JSON object from an online file
      Parameters:
      url - the path to file
      Returns:
      the JSON object of the file
    • getFromObject

      public static String getFromObject(String url, String key)
      Gets a string item from an online JSON object
      Parameters:
      url - the link to your online JSON file containing your JSON object
      key - the key to the member of your object
      Returns:
      the content of the member key in your online JSON object