Class JsonUtils

java.lang.Object
org.polyfrost.oneconfig.utils.v1.JsonUtils

public final class JsonUtils extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.google.gson.JsonParser
    Deprecated.
    The json parser by default accepts non-json compliant formats, this enables parsing invalid json and therefore may cause undesired behaviour.
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NotNull com.google.gson.JsonElement
    parse(@NotNull String json)
     
    static void
    parse(@Nullable String json, Consumer<@NotNull com.google.gson.JsonElement> action)
     
    static @Nullable com.google.gson.JsonElement
     
    static void
    parseFromUrl(String url, Consumer<@NotNull com.google.gson.JsonElement> action)
     
    static void
    parseFromUrlAsync(String url, Consumer<@NotNull com.google.gson.JsonElement> action)
     
    static @Nullable com.google.gson.JsonElement
    parseOrNull(@Nullable String json)
     

    Methods inherited from class java.lang.Object

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

    • PARSER

      @Deprecated public static final com.google.gson.JsonParser PARSER
      Deprecated.
      The json parser by default accepts non-json compliant formats, this enables parsing invalid json and therefore may cause undesired behaviour.
  • Method Details

    • parse

      @NotNull public static @NotNull com.google.gson.JsonElement parse(@NotNull @NotNull String json) throws com.google.gson.JsonSyntaxException
      Throws:
      com.google.gson.JsonSyntaxException
    • parseOrNull

      @Nullable public static @Nullable com.google.gson.JsonElement parseOrNull(@Nullable @Nullable String json)
    • parse

      public static void parse(@Nullable @Nullable String json, Consumer<@NotNull com.google.gson.JsonElement> action)
    • parseFromUrl

      @Nullable public static @Nullable com.google.gson.JsonElement parseFromUrl(String url)
    • parseFromUrl

      public static void parseFromUrl(String url, Consumer<@NotNull com.google.gson.JsonElement> action)
    • parseFromUrlAsync

      public static void parseFromUrlAsync(String url, Consumer<@NotNull com.google.gson.JsonElement> action)