Class JSONUtil

java.lang.Object
com.jbstrap.core.utils.JSONUtil

public final class JSONUtil extends Object
Class containing the JSON utility methods
Since:
4.0
Author:
JBStrap
  • Method Details

    • toJson

      public static String toJson(Object obj)

      Creates a JSON object based on the specified Java object.

      During the conversion, the class' JSonAttribute annotations will be used as a basis.

      Parameters:
      obj - The Java object to be converted
      Returns:
      The converted JSON object
      See Also:
    • getJsonValue

      public static Object getJsonValue(com.google.gson.JsonElement element)
      Determines the Java value from the specified JSON object.
      Parameters:
      element - The JSON object element
      Returns:
      The Java value
    • toJSON

      public static String toJSON(Parameters prm)
      Converts a parameter object to a JSON string.
      Parameters:
      prm - Parameter object
      Returns:
      JSON string corresponding to the specified parameter object
    • toJSONValue

      public static String toJSONValue(Object value)
      Converts a Java value to the corresponding JSON value.
      Parameters:
      value - Java value
      Returns:
      JSON value