Class JsonUtil

java.lang.Object
net.guizhanss.guizhanlib.utils.JsonUtil

public final class JsonUtil extends Object
Utility methods about json parser.
Author:
ybw0014
  • Constructor Details

    • JsonUtil

      public JsonUtil()
  • Method Details

    • parse

      @Nonnull public static com.google.gson.JsonElement parse(@Nonnull String json)
      Parse json String.
      Parameters:
      json - The string to be parsed.
      Returns:
      The parsed JsonElement.
    • parse

      @Nonnull public static com.google.gson.JsonElement parse(@Nonnull BufferedReader reader)
      Parse json from BufferedReader.
      Parameters:
      reader - The BufferedReader to read json from.
      Returns:
      The parsed JsonElement.
    • getFromPath

      @Nullable public static com.google.gson.JsonElement getFromPath(@Nonnull com.google.gson.JsonObject root, @Nonnull String path)
      The value from given path of JsonObject.
      Parameters:
      root - Root JsonElement.
      path - The path of target value.
      Returns:
      The value got from path, null if not found.